Fix signed/unsigned mismatch warning in decoder_buffer.h (#951)

Fixed warning regarding comparing a signed variable `bit` with unsigned `nbits`.

The value `nbits` is checked to be less then or equal to 32 in the rows above, which prevents
overflow when casting to a signed type.
This commit is contained in:
Björn Blissing 2022-12-01 06:55:47 +01:00 committed by GitHub
parent d44cb5bc7d
commit 7ec8a2783f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,7 +162,7 @@ class DecoderBuffer {
return false;
}
uint32_t value = 0;
for (int32_t bit = 0; bit < nbits; ++bit) {
for (int32_t bit = 0; bit < static_cast<int32_t>(nbits); ++bit) {
value |= GetBit() << bit;
}
*x = value;