mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-04-23 06:09:57 +08:00
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:
parent
d44cb5bc7d
commit
7ec8a2783f
@ -162,7 +162,7 @@ class DecoderBuffer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint32_t value = 0;
|
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;
|
value |= GetBit() << bit;
|
||||||
}
|
}
|
||||||
*x = value;
|
*x = value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user