add some missing type conversions to make h_read_bits work with count>32

This commit is contained in:
Sven M. Hallberg 2015-02-12 01:40:45 +01:00
parent 8aba9ce217
commit 2eaf5d9052
2 changed files with 44 additions and 2 deletions

View file

@ -62,7 +62,7 @@ int64_t h_read_bits(HInputStream* state, int count, char signed_p) {
int i;
for (i = 0; count > 0; i += 8) {
count -= 8;
out |= state->input[state->index++] << i;
out |= (int64_t)state->input[state->index++] << i;
}
}
} else {
@ -99,7 +99,7 @@ int64_t h_read_bits(HInputStream* state, int count, char signed_p) {
if (state->endianness & BYTE_BIG_ENDIAN) {
out = out << segment_len | segment;
} else { // BYTE_LITTLE_ENDIAN
out |= segment << offset;
out |= (int64_t)segment << offset;
offset += segment_len;
}
count -= segment_len;