Add ByteArrayUtils::readSignedInt24andAdvancePosition to read dynamic dictionaries.

Bug: 6669677
Change-Id: I75eeedbb50868432f6a7ff5fa63624d03e788356
main
Keisuke Kuroynagi 2013-06-21 12:58:18 +09:00
parent 93f74bafbb
commit 8a914a66e8
1 changed files with 11 additions and 0 deletions

View File

@ -57,6 +57,17 @@ class ByteArrayUtils {
return value;
}
static AK_FORCE_INLINE int readSint24andAdvancePosition(
const uint8_t *const buffer, int *const pos) {
const uint8_t value = readUint8(buffer, *pos);
if (value < 0x80) {
return readUint24andAdvancePosition(buffer, pos);
} else {
(*pos)++;
return -(((value & 0x7F) << 16) ^ readUint16andAdvancePosition(buffer, pos));
}
}
static AK_FORCE_INLINE uint32_t readUint24andAdvancePosition(
const uint8_t *const buffer, int *const pos) {
const uint32_t value = readUint24(buffer, *pos);