Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
akuzm committed Jul 6, 2023
1 parent 8a8fd24 commit c16434c
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tsl/src/compression/simple8b_rle_bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,17 @@ simple8brle_bitmap_prefixsums(Simple8bRleSerialized *compressed)
Assert(SIMPLE8B_BIT_LENGTH[selector_value] == 1);
Assert(SIMPLE8B_NUM_ELEMENTS[selector_value] == 64);

/* Have to zero out the unused bits, so that the popcnt works properly. */
const uint16 elements_this_block =
Min(64U, (uint16) (num_elements - decompressed_index));
Assert(elements_this_block <= 64);

/*
* We should require at least one element from the block. Previous
* blocks might have had incorrect lengths, so this is not an
* assertion.
*/
CheckCompressedData(elements_this_block > 0);
CheckCompressedData(decompressed_index < num_elements);

/* Have to zero out the unused bits, so that the popcnt works properly. */
const int elements_this_block = Min(64, num_elements - decompressed_index);
Assert(elements_this_block <= 64);
Assert(elements_this_block > 0);
block_data &= (-1ULL) >> (64 - elements_this_block);

/*
Expand Down Expand Up @@ -218,7 +218,7 @@ simple8brle_bitmap_decompress(Simple8bRleSerialized *compressed)
const uint16 num_elements_padded = ((num_elements + 63) / 64 + 1) * 64;
const uint16 num_blocks = compressed->num_blocks;

bool *restrict bitmap_bools_ = palloc(num_elements_padded);
bool *restrict bitmap_bools_ = palloc(sizeof(bool) * num_elements_padded);
uint16 decompressed_index = 0;
for (uint16 block_index = 0; block_index < num_blocks; block_index++)
{
Expand Down Expand Up @@ -286,16 +286,17 @@ simple8brle_bitmap_decompress(Simple8bRleSerialized *compressed)
Assert(SIMPLE8B_BIT_LENGTH[selector_value] == 1);
Assert(SIMPLE8B_NUM_ELEMENTS[selector_value] == 64);

/* Have to zero out the unused bits, so that the popcnt works properly. */
const uint16 elements_this_block =
Min(64U, (uint16) (num_elements - decompressed_index));
Assert(elements_this_block <= 64);
/*
* We should require at least one element from the block. Previous
* blocks might have had incorrect lengths, so this is not an
* assertion.
*/
CheckCompressedData(elements_this_block > 0);
CheckCompressedData(decompressed_index < num_elements);

/* Have to zero out the unused bits, so that the popcnt works properly. */
const int elements_this_block = Min(64, num_elements - decompressed_index);
Assert(elements_this_block <= 64);
Assert(elements_this_block > 0);
block_data &= (-1ULL) >> (64 - elements_this_block);

/*
Expand Down

0 comments on commit c16434c

Please sign in to comment.