From 7ec8a2783f4c86d5f3c9120d1d58c7ce1b3094ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Blissing?= Date: Thu, 1 Dec 2022 06:55:47 +0100 Subject: [PATCH] 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. --- src/draco/core/decoder_buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/draco/core/decoder_buffer.h b/src/draco/core/decoder_buffer.h index be98e52..0121199 100644 --- a/src/draco/core/decoder_buffer.h +++ b/src/draco/core/decoder_buffer.h @@ -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(nbits); ++bit) { value |= GetBit() << bit; } *x = value;