Fix #118
NEWS: * Switching endianness mid-byte no longer potentially re-reads bytes. * bit_offset now consistently refers to the number of bits already read. * HParsedTokens now have a bit_length field; this is a size_t. This may be removed for memory reasons. The bit writer has not yet been updated to match; the result of switching bit writer endianness in the middle of a byte remains undefined.
This commit is contained in:
parent
58af99ae40
commit
af73181cf4
12 changed files with 86 additions and 48 deletions
|
|
@ -4,14 +4,14 @@
|
|||
#include "internal.h"
|
||||
#include "test_suite.h"
|
||||
|
||||
#define MK_INPUT_STREAM(buf,len,endianness_) \
|
||||
#define MK_INPUT_STREAM(buf,len,endianness_) \
|
||||
{ \
|
||||
.input = (uint8_t*)buf, \
|
||||
.length = len, \
|
||||
.index = 0, \
|
||||
.bit_offset = (((endianness_) & BIT_BIG_ENDIAN) ? 8 : 0), \
|
||||
.endianness = endianness_ \
|
||||
}
|
||||
.input = (uint8_t*)buf, \
|
||||
.length = len, \
|
||||
.index = 0, \
|
||||
.bit_offset = 0, \
|
||||
.endianness = endianness_ \
|
||||
}
|
||||
|
||||
|
||||
static void test_bitreader_ints(void) {
|
||||
|
|
@ -56,7 +56,6 @@ static void test_offset_largebits_le(void) {
|
|||
g_check_cmp_int32(h_read_bits(&is, 11, false), ==, 0x2D3);
|
||||
}
|
||||
|
||||
|
||||
void register_bitreader_tests(void) {
|
||||
g_test_add_func("/core/bitreader/be", test_bitreader_be);
|
||||
g_test_add_func("/core/bitreader/le", test_bitreader_le);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue