Skip to content

Commit 5eea057

Browse files
committed
Fix integer overflow
1 parent 511093a commit 5eea057

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/slimcpplib/long_uint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ constexpr long_uint_t<native_t, size>::long_uint_t(type_t value) noexcept
180180

181181
for (uint_t n = 0; n < value_size; ++n) {
182182

183-
digits[n] = value & native_t(~0);
183+
digits[n] = value & ~native_t(0);
184184
value >>= std::min(bit_count_v<type_t> - 1, bit_count_v<native_t>);
185185
}
186186
for (uint_t n = value_size; n < std::size(digits); ++n)

0 commit comments

Comments
 (0)