Skip to content

Commit

Permalink
Workaround a bug in MSVC <= 19.22
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jan 24, 2023
1 parent cae9bf4 commit a2c05a1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions include/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ FMT_CONSTEXPR inline uint64_t rotr(uint64_t n, uint32_t r) noexcept {
return (n >> r) | (n << (64 - r));
}



// Implementation of Dragonbox algorithm: https://github.com/jk-jeon/dragonbox.
namespace dragonbox {
// Computes upper 64 bits of multiplication of a 32-bit unsigned integer and a
Expand Down Expand Up @@ -1021,8 +1019,7 @@ template <> struct cache_accessor<double> {
{0xe4d5e82392a40515, 0x0fabaf3feaa5334b},
{0xb8da1662e7b00a17, 0x3d6a751f3b936244},
{0x95527a5202df0ccb, 0x0f37801e0c43ebc9},
{ 0xf13e34aabb430a15,
0x647726b9e7c68ff0 }
{0xf13e34aabb430a15, 0x647726b9e7c68ff0}
#endif
};

Expand Down Expand Up @@ -1144,7 +1141,8 @@ FMT_INLINE int remove_trailing_zeros(uint32_t& n) noexcept {
// Modular inverse of 5 (mod 2^32): (mod_inv_5 * 5) mod 2^32 = 1.
// See https://github.com/fmtlib/fmt/issues/3163 for more details.
const uint32_t mod_inv_5 = 0xcccccccd;
const uint32_t mod_inv_25 = mod_inv_5 * mod_inv_5;
// Casts are needed to workaround a bug in MSVC 19.22 and older.
const uint32_t mod_inv_25 = uint32_t(uint64_t(mod_inv_5) * mod_inv_5);

int s = 0;
while (true) {
Expand Down

0 comments on commit a2c05a1

Please sign in to comment.