diff options
author | Benjamin Barenblat <bbaren@google.com> | 2023-09-07 13:16:09 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2023-09-07 13:16:09 -0400 |
commit | 6fdbff8bbce2a1debdc060df381f39e3dcfb65af (patch) | |
tree | 71f1ef38477a65d5cce472fc042c90087c2bb351 /absl/strings/internal/str_format/float_conversion.cc | |
parent | 8d4a80fe37176b1170d7dce0772dea9584ec3e32 (diff) | |
parent | 29bf8085f3bf17b84d30e34b3d7ff8248fda404e (diff) | |
download | abseil-6fdbff8bbce2a1debdc060df381f39e3dcfb65af.tar.gz abseil-6fdbff8bbce2a1debdc060df381f39e3dcfb65af.tar.bz2 abseil-6fdbff8bbce2a1debdc060df381f39e3dcfb65af.zip |
Merge new upstream LTS 20230802.0
Diffstat (limited to 'absl/strings/internal/str_format/float_conversion.cc')
-rw-r--r-- | absl/strings/internal/str_format/float_conversion.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/absl/strings/internal/str_format/float_conversion.cc b/absl/strings/internal/str_format/float_conversion.cc index 8e497852..8edf520d 100644 --- a/absl/strings/internal/str_format/float_conversion.cc +++ b/absl/strings/internal/str_format/float_conversion.cc @@ -711,12 +711,12 @@ bool IncrementNibble(size_t nibble_index, Int* n) { constexpr size_t kShift = sizeof(Int) * 8 - 1; constexpr size_t kNumNibbles = sizeof(Int) * 8 / 4; Int before = *n >> kShift; - // Here we essentially want to take the number 1 and move it into the requsted - // nibble, then add it to *n to effectively increment the nibble. However, - // ASan will complain if we try to shift the 1 beyond the limits of the Int, - // i.e., if the nibble_index is out of range. So therefore we check for this - // and if we are out of range we just add 0 which leaves *n unchanged, which - // seems like the reasonable thing to do in that case. + // Here we essentially want to take the number 1 and move it into the + // requested nibble, then add it to *n to effectively increment the nibble. + // However, ASan will complain if we try to shift the 1 beyond the limits of + // the Int, i.e., if the nibble_index is out of range. So therefore we check + // for this and if we are out of range we just add 0 which leaves *n + // unchanged, which seems like the reasonable thing to do in that case. *n += ((nibble_index >= kNumNibbles) ? 0 : (Int{1} << static_cast<int>(nibble_index * 4))); @@ -937,7 +937,7 @@ void FormatA(const HexFloatTypeParams float_traits, Int mantissa, int exp, // =============== Exponent ================== constexpr size_t kBufSizeForExpDecRepr = - numbers_internal::kFastToBufferSize // requred for FastIntToBuffer + numbers_internal::kFastToBufferSize // required for FastIntToBuffer + 1 // 'p' or 'P' + 1; // '+' or '-' char exp_buffer[kBufSizeForExpDecRepr]; @@ -1015,7 +1015,7 @@ struct Buffer { --end; } - char &back() { + char &back() const { assert(begin < end); return end[-1]; } @@ -1102,7 +1102,7 @@ void PrintExponent(int exp, char e, Buffer *out) { template <typename Float, typename Int> constexpr bool CanFitMantissa() { return -#if defined(__clang__) && !defined(__SSE3__) +#if defined(__clang__) && (__clang_major__ < 9) && !defined(__SSE3__) // Workaround for clang bug: https://bugs.llvm.org/show_bug.cgi?id=38289 // Casting from long double to uint64_t is miscompiled and drops bits. (!std::is_same<Float, long double>::value || |