Skip to content

Commit b6ab863

Browse files
authored
Merge pull request #30 from wx257osn2/remove-ub
Remove UB
2 parents 01f2166 + fa4479d commit b6ab863

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/qoixx.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ class qoi{
758758
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
759759
};
760760
static constexpr unsigned lsb32(std::uint32_t x)noexcept{
761-
return de_bruijn_bit_position_sequence[(static_cast<std::uint32_t>(x&-static_cast<std::int32_t>(x))*0x077cb531u) >> 27];
761+
return de_bruijn_bit_position_sequence[(static_cast<std::uint32_t>(x&(~x+1u))*0x077cb531u) >> 27u];
762762
}
763763
template<std::uint8_t M>
764764
static inline __m256i slli_epi8(__m256i v)noexcept{

0 commit comments

Comments
 (0)