Skip to content

Commit c8978da

Browse files
authored
fix: Fix undefined behavior in BinarySection bitmask constants caused by signed left shift (alibaba#303)
1 parent 24a0bfc commit c8978da

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/paimon/common/data/binary_section.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ class PAIMON_EXPORT BinarySection {
4848
/// This is used to decide whether the data is stored in fixed-length part or
4949
/// variable-length part. see `MAX_FIX_PART_DATA_SIZE` for more information.
5050

51-
static constexpr int64_t HIGHEST_FIRST_BIT = 0x80L << 56;
51+
static constexpr int64_t HIGHEST_FIRST_BIT = static_cast<int64_t>(0x80ULL << 56);
5252
/// To get the 7 bits length in second bit to eighth bit out of a int64_t. Form:
5353
/// 01111111 00000000... (8 bytes)
5454
/// This is used to get the length of the data which is stored in this int64_t. see
5555
/// `MAX_FIX_PART_DATA_SIZE` for more information.
5656

57-
static constexpr int64_t HIGHEST_SECOND_TO_EIGHTH_BIT = 0x7FL << 56;
57+
static constexpr int64_t HIGHEST_SECOND_TO_EIGHTH_BIT = static_cast<int64_t>(0x7FULL << 56);
5858

5959
/// Get binary, if len less than 8, will be include in variable_part_offset_and_len.
6060
/// @note Need to consider the ByteOrder.

0 commit comments

Comments
 (0)