| 1 | /* NOLINT(build/header_guard) */cxx . . $ `<file>/c/enc/histogram_inc.h`/ |
| 2 | /* Copyright 2013 Google Inc. All Rights Reserved. |
| 3 | |
| 4 | Distributed under MIT license. |
| 5 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT |
| 6 | */ |
| 7 | |
| 8 | /* template parameters: Histogram, DATA_SIZE, DataType */ |
| 9 | |
| 10 | /* A simple container for histograms of data in blocks. */ |
| 11 | |
| 12 | typedef struct FNcxx . . $ `c/enc/histogram.h:40:9`!(Histogram) { |
| 13 | uint32_tcxx . . $ uint32_t# data_cxx . . $ HistogramDistance#data_.[DATA_SIZEcxx . . $ `c/enc/histogram.h:41:9`!]; |
| 14 | size_t total_count_cxx . . $ HistogramDistance#total_count_.; |
| 15 | double bit_cost_cxx . . $ HistogramDistance#bit_cost_.; |
| 16 | } FNcxx . . $ `c/enc/histogram.h:40:9`!(Histogram); |
| 17 | |
| 18 | static BROTLI_INLINEcxx . . $ `c/common/platform.h:119:9`! void FNcxx . . $ `c/enc/histogram.h:40:9`!(HistogramClear)(FNcxx . . $ `c/enc/histogram.h:40:9`!(Histogram)* self) { |
| 19 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(self->data_cxx . . $ HistogramDistance#data_., 0, sizeof(self->data_cxx . . $ HistogramDistance#data_.)); |
| 20 | self->total_count_cxx . . $ HistogramDistance#total_count_. = 0; |
| 21 | self->bit_cost_cxx . . $ HistogramDistance#bit_cost_. = HUGE_VALcxx . . $ `<external>/11263917310783833665/math.h:49:10`!; |
| 22 | } |
| 23 | |
| 24 | static BROTLI_INLINEcxx . . $ `c/common/platform.h:119:9`! void FNcxx . . $ `c/enc/histogram.h:40:9`!(ClearHistograms)( |
| 25 | FNcxx . . $ `c/enc/histogram.h:40:9`!(Histogram)* array, size_t length) { |
| 26 | size_t i; |
| 27 | for (i = 0; i < length; ++i) FNcxx . . $ `c/enc/histogram.h:40:9`!(HistogramClear)(array + i); |
| 28 | } |
| 29 | |
| 30 | static BROTLI_INLINEcxx . . $ `c/common/platform.h:119:9`! void FNcxx . . $ `c/enc/histogram.h:40:9`!(HistogramAdd)(FNcxx . . $ `c/enc/histogram.h:40:9`!(Histogram)* self, size_t val) { |
| 31 | ++self->data_cxx . . $ HistogramDistance#data_.[val]; |
| 32 | ++self->total_count_cxx . . $ HistogramDistance#total_count_.; |
| 33 | } |
| 34 | |
| 35 | static BROTLI_INLINEcxx . . $ `c/common/platform.h:119:9`! void FNcxx . . $ `c/enc/histogram.h:40:9`!(HistogramAddVector)(FNcxx . . $ `c/enc/histogram.h:40:9`!(Histogram)* self, |
| 36 | const DataTypecxx . . $ `c/enc/histogram.h:34:9`!* p, size_t n) { |
| 37 | self->total_count_cxx . . $ HistogramDistance#total_count_. += n; |
| 38 | n += 1; |
| 39 | while (--n) ++self->data_cxx . . $ HistogramDistance#data_.[*p++]; |
| 40 | } |
| 41 | |
| 42 | static BROTLI_INLINEcxx . . $ `c/common/platform.h:119:9`! void FNcxx . . $ `c/enc/histogram.h:40:9`!(HistogramAddHistogram)(FNcxx . . $ `c/enc/histogram.h:40:9`!(Histogram)* self, |
| 43 | const FNcxx . . $ `c/enc/histogram.h:40:9`!(Histogram)* v) { |
| 44 | size_t i; |
| 45 | self->total_count_cxx . . $ HistogramDistance#total_count_. += v->total_count_cxx . . $ HistogramDistance#total_count_.; |
| 46 | for (i = 0; i < DATA_SIZEcxx . . $ `c/enc/histogram.h:41:9`!; ++i) { |
| 47 | self->data_cxx . . $ HistogramDistance#data_.[i] += v->data_cxx . . $ HistogramDistance#data_.[i]; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | static BROTLI_INLINEcxx . . $ `c/common/platform.h:119:9`! size_t FNcxx . . $ `c/enc/histogram.h:40:9`!(HistogramDataSize)(void) { return DATA_SIZEcxx . . $ `c/enc/histogram.h:41:9`!; } |