File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
include/boost/decimal/detail Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,13 @@ constexpr auto remove_trailing_zeros(std::uint32_t n) noexcept -> remove_trailin
4040{
4141 std::size_t s {};
4242
43- auto r = rotr<32 >(n * UINT32_C (184254097 ), 4 );
44- auto b = r < UINT32_C (429497 );
43+ auto r = rotr<32 >(n * UINT32_C (15273505 ), 8 );
44+ auto b = r < UINT32_C (43 );
45+ s = s * 2U + static_cast <std::size_t >(b);
46+ n = b ? r : n;
47+
48+ r = rotr<32 >(n * UINT32_C (184254097 ), 4 );
49+ b = r < UINT32_C (429497 );
4550 s = s * 2U + static_cast <std::size_t >(b);
4651 n = b ? r : n;
4752
@@ -62,8 +67,13 @@ constexpr auto remove_trailing_zeros(std::uint64_t n) noexcept -> remove_trailin
6267{
6368 std::size_t s {};
6469
65- auto r = rotr<64 >(n * UINT64_C (28999941890838049 ), 8 );
66- auto b = r < UINT64_C (184467440738 );
70+ auto r = rotr<64 >(n * UINT64_C (230079197716545 ), 16 );
71+ auto b = r < UINT64_C (1845 );
72+ s = s * 2U + static_cast <std::size_t >(b);
73+ n = b ? r : n;
74+
75+ r = rotr<64 >(n * UINT64_C (28999941890838049 ), 8 );
76+ b = r < UINT64_C (184467440738 );
6777 s = s * 2U + static_cast <std::size_t >(b);
6878 n = b ? r : n;
6979
You can’t perform that action at this time.
0 commit comments