Remove unnecessary comparison. Thank you, Victor, for verifying that clang is able to determine at compile time that |value| can never be larger than numeric_limits::max() and therefore is able to optimize away the if branch. See cr/227019741. gfe-relnote: n/a Should not change binary. PiperOrigin-RevId: 227033117 Change-Id: Icf319bf50837c3843986a102d1232879d655dc45
diff --git a/http2/hpack/decoder/hpack_string_decoder.h b/http2/hpack/decoder/hpack_string_decoder.h index 88b1add..5e0d220 100644 --- a/http2/hpack/decoder/hpack_string_decoder.h +++ b/http2/hpack/decoder/hpack_string_decoder.h
@@ -173,10 +173,8 @@ const uint64_t value = length_decoder_.value(); // |remaining_| is size_t. Check for truncation on 32-bit platforms. // numeric_limits::max() is constexpr. On platforms where size_t is at - // least 64 bit wide, the compiler optimizes away this branch. - if (std::numeric_limits<uint64_t>::max() > - std::numeric_limits<size_t>::max() && - value > std::numeric_limits<size_t>::max()) { + // least 64 bit wide, the compiler should optimize away this branch. + if (value > std::numeric_limits<size_t>::max()) { *status = DecodeStatus::kDecodeError; return; }