@@ -531,17 +531,16 @@ auto write_significand(char* buffer, uint64_t value, bool extra_digit,
531531 }
532532#if ZMIJ_USE_NEON
533533 // An optimized version for NEON by Dougall Johnson.
534- constexpr int32_t neg10k = -10000 + 0x10000 ;
535534 using int32x4 = std::conditional_t <ZMIJ_MSC_VER != 0 , int32_t [4 ], int32x4_t >;
536535 using int16x8 = std::conditional_t <ZMIJ_MSC_VER != 0 , int16_t [8 ], int16x8_t >;
537- struct mul_constants {
536+ constexpr int32_t neg10k = -10000 + 0x10000 ;
537+ alignas (64 ) static constexpr struct {
538538 uint64_t mul_const = 0xabcc77118461cefd ;
539539 uint64_t hundred_million = 100000000 ;
540540 int32x4 multipliers32 = {div10k_sig, neg10k, div100_sig << 12 , neg100};
541541 int16x8 multipliers16 = {0xce0 , neg10};
542- };
543- static const mul_constants constants;
544- const mul_constants* c = &constants;
542+ } consts;
543+ const auto * c = &consts;
545544
546545 // Compiler barrier, or clang doesn't load from memory and generates 15 more
547546 // instructions.
@@ -610,7 +609,7 @@ auto write_significand(char* buffer, uint64_t value, bool extra_digit,
610609 uint32_t abcdefgh = value_div10 / uint64_t (1e8 );
611610 uint32_t ijklmnop = value_div10 % uint64_t (1e8 );
612611
613- alignas (64 ) static constexpr struct constants {
612+ alignas (64 ) static constexpr struct {
614613 static constexpr auto splat64 (uint64_t x) -> uint128 { return {x, x}; }
615614 static constexpr auto splat32 (uint32_t x) -> uint128 {
616615 return splat64 (uint64_t (x) << 32 | x);
@@ -641,11 +640,8 @@ auto write_significand(char* buffer, uint64_t value, bool extra_digit,
641640# endif
642641 uint128 zeros = splat64(::zeros);
643642 } consts;
644-
645- const constants* c = &consts;
646- // Make the compiler forget where the constants came from to ensure they are
647- // loaded from memory.
648- ZMIJ_ASM ((" " : " +r" (c)));
643+ const auto * c = &consts;
644+ ZMIJ_ASM ((" " : " +r" (c))); // Load constants from memory.
649645
650646 using ptr = const __m128i*;
651647 const __m128i div10k = _mm_load_si128 (ptr (&c->div10k ));
0 commit comments