Export of internal Abseil changes

--
cc712eea29157198dc2ad001a0b8717bf6621074 by Abseil Team <absl-team@google.com>:

Quiet -Wsign-compare warning in AdvanceDigits().

PiperOrigin-RevId: 328972215

--
0b7a7ccd7c5c201062ed9671a8b2f5cc53b76ded by Abseil Team <absl-team@google.com>:

Quiet -Wsign-compare warning in ExtraWidthToPadding()

PiperOrigin-RevId: 328882525

--
df828f8e78276897ad0f8aed8a94ac9882f719ee by Abseil Team <absl-team@google.com>:

Quiet -Wsign-compare warning

PiperOrigin-RevId: 328840508
GitOrigin-RevId: cc712eea29157198dc2ad001a0b8717bf6621074
Change-Id: Ie7caa022ee308d84c2f3b5ff7a9b3d02e0f30587
pull/780/head
Abseil Team 5 years ago committed by Andy Getz
parent 4d2ff381a3
commit a4cbb5f698
  1. 10
      absl/strings/internal/str_format/float_conversion.cc

@ -205,7 +205,7 @@ class BinaryToDecimal {
}
private:
static constexpr size_t kDigitsPerChunk = 9;
static constexpr int kDigitsPerChunk = 9;
int decimal_start_;
int decimal_end_;
@ -442,8 +442,10 @@ struct Padding {
};
Padding ExtraWidthToPadding(size_t total_size, const FormatState &state) {
if (state.conv.width() < 0 || state.conv.width() <= total_size)
if (state.conv.width() < 0 ||
static_cast<size_t>(state.conv.width()) <= total_size) {
return {0, 0, 0};
}
int missing_chars = state.conv.width() - total_size;
if (state.conv.has_left_flag()) {
return {0, 0, missing_chars};
@ -685,9 +687,7 @@ bool IncrementNibble(int nibble_index, Int *n) {
// 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 * 4 >= sizeof(Int) * 8) ? 0
: (Int{1} << (nibble_index * 4)));
*n += ((nibble_index >= kNumNibbles) ? 0 : (Int{1} << (nibble_index * 4)));
Int after = *n >> kShift;
return (before && !after) || (nibble_index >= kNumNibbles);
}

Loading…
Cancel
Save