32-bit value fix to the 64-bit type.

This commit is contained in:
drillsar 2017-07-01 22:37:12 -04:00
parent 0c20f1c0fc
commit 2d13fdd681
1 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ uint64_t BitStream::Peek(size_t num_bits) {
// AND with mask // AND with mask
// ...................| target bits | // ...................| target bits |
bits &= (1 << num_bits) - 1; bits &= (1ULL << num_bits) - 1;
return bits; return bits;
} }
@ -74,7 +74,7 @@ bool BitStream::Write(uint64_t val, size_t num_bits) {
size_t rel_offset_bits = offset_bits_ - (offset_bytes << 3); size_t rel_offset_bits = offset_bits_ - (offset_bytes << 3);
// Construct a mask // Construct a mask
uint64_t mask = (1 << num_bits) - 1; uint64_t mask = (1ULL << num_bits) - 1;
mask <<= 64 - (rel_offset_bits + num_bits); mask <<= 64 - (rel_offset_bits + num_bits);
mask = ~mask; mask = ~mask;