| 100 | /// RleBatchDecoder as argument. |
| 101 | template <typename T> |
| 102 | inline int32_t GetValuesMemset(int32_t num_values_to_consume, T* values, |
| 103 | RleBatchDecoder<T>* decoder) { |
| 104 | int32_t num_consumed = 0; |
| 105 | while (num_consumed < num_values_to_consume) { |
| 106 | // Add RLE encoded values by repeating the current value this number of times. |
| 107 | uint32_t num_repeats = decoder->NextNumRepeats(); |
| 108 | if (num_repeats > 0) { |
| 109 | uint32_t num_repeats_to_set = |
| 110 | min<uint32_t>(num_repeats, num_values_to_consume - num_consumed); |
| 111 | T repeated_value = decoder->GetRepeatedValue(num_repeats_to_set); |
| 112 | memset(values + num_consumed, repeated_value, num_repeats_to_set); |
| 113 | num_consumed += num_repeats_to_set; |
| 114 | continue; |
| 115 | } |
| 116 | |
| 117 | // Add remaining literal values, if any. |
| 118 | uint32_t num_literals = decoder->NextNumLiterals(); |
| 119 | if (num_literals == 0) break; |
| 120 | uint32_t num_literals_to_set = |
| 121 | min<uint32_t>(num_literals, num_values_to_consume - num_consumed); |
| 122 | if (!decoder->GetLiteralValues(num_literals_to_set, values + num_consumed)) { |
| 123 | DCHECK(false); |
| 124 | return 0; |
| 125 | } |
| 126 | num_consumed += num_literals_to_set; |
| 127 | } |
| 128 | return num_consumed; |
| 129 | } |
| 130 | |
| 131 | /// Benchmark calling RleBatchDecoder<uint8_t>::GetValues(). |
| 132 | void RleBenchmark(int batch_size, void* data) { |
no test coverage detected