forked from rarten/ooz
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbitreader.h
34 lines (30 loc) · 1.15 KB
/
bitreader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "stdafx.h"
#include "vectorize.h"
struct BitReader2 {
const uint8 *p, *p_end;
uint32 bitpos;
};
typedef struct BitReader {
// |p| holds the current byte and |p_end| the end of the buffer.
const byte *p, *p_end;
// Bits accumulated so far
uint32 bits;
// Next byte will end up in the |bitpos| position in |bits|.
int bitpos;
} BitReader;
bool BitReader_ReadLengthB(BitReader *bits, uint32 *v);
bool BitReader_ReadLength(BitReader *bits, uint32 *v);
uint32 BitReader_ReadDistanceB(BitReader *bits, uint32 v);
uint32 BitReader_ReadDistance(BitReader *bits, uint32 v);
int BitReader_ReadGammaX(BitReader *bits, int forced);
int BitReader_ReadGamma(BitReader *bits);
uint32 BitReader_ReadMoreThan24BitsB(BitReader *bits, int n);
uint32 BitReader_ReadMoreThan24Bits(BitReader *bits, int n);
int BitReader_ReadBitsNoRefillZero(BitReader *bits, int n);
int BitReader_ReadBitsNoRefill(BitReader *bits, int n);
int BitReader_ReadBitNoRefill(BitReader *bits);
int BitReader_ReadBit(BitReader *bits);
void BitReader_RefillBackwards(BitReader *bits);
void BitReader_Refill(BitReader *bits);
int BitReader_ReadFluff(BitReader *bits, int num_symbols);