diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-05-18 20:24:38 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-05-18 20:28:14 +0300 |
commit | 005227479a1b6ffb635da2f8b318db29bdc4eb41 (patch) | |
tree | 4b1f64a30c7878baf9cbdfe57c227f83c3c3f64b | |
parent | 9ababf2e2e870ed2f2434b2dceb1dd9baa3ac6f2 (diff) |
Workaround weird compiler warning.
-rw-r--r-- | third_party/bc-decoder/llvm_bitreader.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/third_party/bc-decoder/llvm_bitreader.h b/third_party/bc-decoder/llvm_bitreader.h index 664b751..f1685ca 100644 --- a/third_party/bc-decoder/llvm_bitreader.h +++ b/third_party/bc-decoder/llvm_bitreader.h @@ -93,7 +93,9 @@ public: assert(groupBitSize > 1 && "chunk size must be greater than 1"); assert(groupBitSize <= 8 && "Only chunk sizes up to 8 supported"); - byte scratch = 0; + + // Avoid false positive warning. + byte scratch[8] = {}; const byte hibit = 1 << (groupBitSize - 1); const byte lobits = hibit - 1; @@ -101,14 +103,14 @@ public: uint64_t shift = 0; do { - ReadBits(groupBitSize, &scratch); + ReadBits(groupBitSize, scratch); assert(shift <= 63); - ret += (uint64_t(scratch & lobits) << shift); + ret += (uint64_t(scratch[0] & lobits) << shift); shift += uint64_t(groupBitSize - 1); - } while(scratch & hibit); + } while(scratch[0] & hibit); #ifndef NDEBUG // check for overflow of the return type |