diff options
author | Benjamin Barenblat <bbaren@google.com> | 2024-09-03 11:49:29 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2024-09-03 11:49:29 -0400 |
commit | c1afa8b8238c25591ca80d068477aa7d4ce05fc8 (patch) | |
tree | 284a9f8b319de5783ff83ad004a9e390cb60fd0d /absl/numeric/internal/bits.h | |
parent | 23778b53f420f54eebc195dd8430e79bda165e5b (diff) | |
parent | 4447c7562e3bc702ade25105912dce503f0c4010 (diff) |
Merge new upstream LTS 20240722.0
Diffstat (limited to 'absl/numeric/internal/bits.h')
-rw-r--r-- | absl/numeric/internal/bits.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/absl/numeric/internal/bits.h b/absl/numeric/internal/bits.h index bfef06bc..0917464d 100644 --- a/absl/numeric/internal/bits.h +++ b/absl/numeric/internal/bits.h @@ -167,7 +167,9 @@ CountLeadingZeroes32(uint32_t x) { ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CLZ inline int CountLeadingZeroes16(uint16_t x) { -#if ABSL_HAVE_BUILTIN(__builtin_clzs) +#if ABSL_HAVE_BUILTIN(__builtin_clzg) + return x == 0 ? 16 : __builtin_clzg(x); +#elif ABSL_HAVE_BUILTIN(__builtin_clzs) static_assert(sizeof(unsigned short) == sizeof(x), // NOLINT(runtime/int) "__builtin_clzs does not take 16-bit arg"); return x == 0 ? 16 : __builtin_clzs(x); @@ -303,7 +305,9 @@ CountTrailingZeroesNonzero64(uint64_t x) { ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int CountTrailingZeroesNonzero16(uint16_t x) { -#if ABSL_HAVE_BUILTIN(__builtin_ctzs) +#if ABSL_HAVE_BUILTIN(__builtin_ctzg) + return __builtin_ctzg(x); +#elif ABSL_HAVE_BUILTIN(__builtin_ctzs) static_assert(sizeof(unsigned short) == sizeof(x), // NOLINT(runtime/int) "__builtin_ctzs does not take 16-bit arg"); return __builtin_ctzs(x); |