Skip to content

Commit cdad7df

Browse files
committed
fast_float_parser.h: fix GCC 8 support
1 parent 97dda65 commit cdad7df

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

ext/json/ext/vendor/fast_float_parser.h

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,10 @@ static inline double ffp_bits2double(uint64_t bits) {
720720
static inline unsigned int
721721
ffc_nlz_int64(uint64_t x)
722722
{
723-
#if defined(_MSC_VER) && defined(__AVX2__) && defined(HAVE___LZCNT64)
723+
#if defined(HAVE_BUILTIN___BUILTIN_CLZLL) && !(defined(__sun) && defined(__sparc))
724+
return (unsigned int)__builtin_clzll((unsigned long long)x);
725+
726+
#elif defined(_MSC_VER) && defined(__AVX2__) && defined(HAVE___LZCNT64)
724727
return (unsigned int)__lzcnt64(x);
725728

726729
#elif defined(__x86_64__) && defined(__LZCNT__) && defined(HAVE__LZCNT_U64)
@@ -730,21 +733,6 @@ ffc_nlz_int64(uint64_t x)
730733
unsigned long r;
731734
return _BitScanReverse64(&r, x) ? (63u - (unsigned int)r) : 64;
732735

733-
#elif defined(__has_builtin) && __has_builtin(__builtin_clzl) && __has_builtin(__builtin_clzll) && !(defined(__sun) && defined(__sparc))
734-
if (x == 0) {
735-
return 64;
736-
}
737-
else if (sizeof(long) * CHAR_BIT == 64) {
738-
return (unsigned int)__builtin_clzl((unsigned long)x);
739-
}
740-
else if (sizeof(long long) * CHAR_BIT == 64) {
741-
return (unsigned int)__builtin_clzll((unsigned long long)x);
742-
}
743-
else {
744-
/* :FIXME: Is there a way to make this branch a compile-time error? */
745-
__builtin_unreachable();
746-
}
747-
748736
#else
749737
uint64_t y;
750738
unsigned int n = 64;

0 commit comments

Comments
 (0)