diff --git a/src/nanoarrow/buffer_inline.h b/src/nanoarrow/buffer_inline.h index 622945f5f..efb5ca712 100644 --- a/src/nanoarrow/buffer_inline.h +++ b/src/nanoarrow/buffer_inline.h @@ -222,8 +222,7 @@ static inline int64_t _ArrowBytesForBits(int64_t bits) { return (bits >> 3) + ((bits & 7) != 0); } -static inline void _ArrowBitmapUnpackInt8(const uint8_t* bits, int8_t* out) { - const uint8_t word = *bits; +static inline void _ArrowBitmapUnpackInt8(const uint8_t word, int8_t* out) { out[0] = (word >> 0) & 1; out[1] = (word >> 1) & 1; out[2] = (word >> 2) & 1; @@ -277,7 +276,7 @@ static inline void ArrowBitmapUnpackInt8Unsafe(const uint8_t* bits, int64_t star // middle bytes for (int64_t i = bytes_begin + 1; i < bytes_last_valid; i++) { - _ArrowBitmapUnpackInt8(&bits[i], out); + _ArrowBitmapUnpackInt8(bits[i], out); out += 8; } diff --git a/src/nanoarrow/buffer_test.cc b/src/nanoarrow/buffer_test.cc index b2ced1428..1907d3712 100644 --- a/src/nanoarrow/buffer_test.cc +++ b/src/nanoarrow/buffer_test.cc @@ -290,28 +290,6 @@ TEST(BitmapTest, BitmapTestBitmapUnpackInt8Unsafe) { EXPECT_EQ(result[i], 1); } - bitmap[2] = 0xfd; - ArrowBitmapUnpackInt8Unsafe(bitmap, 0, sizeof(result), result); - EXPECT_EQ(result[16 + 0], 1); - EXPECT_EQ(result[16 + 1], 0); - EXPECT_EQ(result[16 + 2], 1); - EXPECT_EQ(result[16 + 3], 1); - EXPECT_EQ(result[16 + 4], 1); - EXPECT_EQ(result[16 + 5], 1); - EXPECT_EQ(result[16 + 6], 1); - EXPECT_EQ(result[16 + 7], 1); - - bitmap[2] = 0x02; - ArrowBitmapUnpackInt8Unsafe(bitmap, 0, sizeof(result), result); - EXPECT_EQ(result[16 + 0], 0); - EXPECT_EQ(result[16 + 1], 1); - EXPECT_EQ(result[16 + 2], 0); - EXPECT_EQ(result[16 + 3], 0); - EXPECT_EQ(result[16 + 4], 0); - EXPECT_EQ(result[16 + 5], 0); - EXPECT_EQ(result[16 + 6], 0); - EXPECT_EQ(result[16 + 7], 0); - bitmap[0] = 0x93; // 10010011 bitmap[1] = 0x55; // 01010101 bitmap[2] = 0xaa; // 10101010