| 266 | namespace { |
| 267 | |
| 268 | Result<std::shared_ptr<Buffer>> AllocateDataBuffer(KernelContext* ctx, int64_t length, |
| 269 | int bit_width) { |
| 270 | if (bit_width == 1) { |
| 271 | return ctx->AllocateBitmap(length); |
| 272 | } else { |
| 273 | int64_t buffer_size = bit_util::BytesForBits(length * bit_width); |
| 274 | return ctx->Allocate(buffer_size); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | struct BufferPreallocation { |
| 279 | explicit BufferPreallocation(int bit_width = -1, int added_length = 0) |
no test coverage detected