| 134 | |
| 135 | template <typename DoAnd> |
| 136 | static void BenchmarkAndImpl(benchmark::State& state, DoAnd&& do_and) { |
| 137 | int64_t nbytes = state.range(0); |
| 138 | int64_t offset = state.range(1); |
| 139 | |
| 140 | std::shared_ptr<Buffer> buffer_1 = CreateRandomBuffer(nbytes); |
| 141 | std::shared_ptr<Buffer> buffer_2 = CreateRandomBuffer(nbytes); |
| 142 | std::shared_ptr<Buffer> buffer_3 = CreateRandomBuffer(nbytes); |
| 143 | |
| 144 | const int64_t num_bits = nbytes * 8 - offset; |
| 145 | |
| 146 | internal::Bitmap bitmap_1{buffer_1, 0, num_bits}; |
| 147 | internal::Bitmap bitmap_2{buffer_2, offset, num_bits}; |
| 148 | internal::Bitmap bitmap_3{buffer_3, 0, num_bits}; |
| 149 | |
| 150 | for (auto _ : state) { |
| 151 | do_and({bitmap_1, bitmap_2}, &bitmap_3); |
| 152 | benchmark::ClobberMemory(); |
| 153 | } |
| 154 | state.SetBytesProcessed(state.iterations() * nbytes); |
| 155 | } |
| 156 | |
| 157 | static void BenchmarkBitmapAnd(benchmark::State& state) { |
| 158 | BenchmarkAndImpl(state, [](const internal::Bitmap(&bitmaps)[2], internal::Bitmap* out) { |
no test coverage detected