#include "mem.h"
#include "compiler.h"
#include "debug.h"
#include "error_private.h"
#include "bits.h"
Go to the source code of this file.
|
MEM_STATIC size_t | BIT_initCStream (BIT_CStream_t *bitC, void *dstBuffer, size_t dstCapacity) |
|
MEM_STATIC void | BIT_addBits (BIT_CStream_t *bitC, size_t value, unsigned nbBits) |
|
MEM_STATIC void | BIT_flushBits (BIT_CStream_t *bitC) |
|
MEM_STATIC size_t | BIT_closeCStream (BIT_CStream_t *bitC) |
|
MEM_STATIC size_t | BIT_initDStream (BIT_DStream_t *bitD, const void *srcBuffer, size_t srcSize) |
|
MEM_STATIC size_t | BIT_readBits (BIT_DStream_t *bitD, unsigned nbBits) |
|
MEM_STATIC BIT_DStream_status | BIT_reloadDStream (BIT_DStream_t *bitD) |
|
MEM_STATIC unsigned | BIT_endOfDStream (const BIT_DStream_t *bitD) |
|
MEM_STATIC void | BIT_addBitsFast (BIT_CStream_t *bitC, size_t value, unsigned nbBits) |
|
MEM_STATIC void | BIT_flushBitsFast (BIT_CStream_t *bitC) |
|
MEM_STATIC size_t | BIT_readBitsFast (BIT_DStream_t *bitD, unsigned nbBits) |
|
FORCE_INLINE_TEMPLATE size_t | BIT_getLowerBits (size_t bitContainer, U32 const nbBits) |
|
FORCE_INLINE_TEMPLATE size_t | BIT_getUpperBits (BitContainerType bitContainer, U32 const start) |
|
FORCE_INLINE_TEMPLATE size_t | BIT_getMiddleBits (BitContainerType bitContainer, U32 const start, U32 const nbBits) |
|
FORCE_INLINE_TEMPLATE size_t | BIT_lookBits (const BIT_DStream_t *bitD, U32 nbBits) |
|
MEM_STATIC size_t | BIT_lookBitsFast (const BIT_DStream_t *bitD, U32 nbBits) |
|
FORCE_INLINE_TEMPLATE void | BIT_skipBits (BIT_DStream_t *bitD, U32 nbBits) |
|
MEM_STATIC BIT_DStream_status | BIT_reloadDStream_internal (BIT_DStream_t *bitD) |
|
MEM_STATIC BIT_DStream_status | BIT_reloadDStreamFast (BIT_DStream_t *bitD) |
|
◆ BIT_MASK_SIZE
#define BIT_MASK_SIZE (sizeof(BIT_mask) / sizeof(BIT_mask[0])) |
◆ STREAM_ACCUMULATOR_MIN
◆ STREAM_ACCUMULATOR_MIN_32
#define STREAM_ACCUMULATOR_MIN_32 25 |
◆ STREAM_ACCUMULATOR_MIN_64
#define STREAM_ACCUMULATOR_MIN_64 57 |
◆ BitContainerType
◆ BIT_DStream_status
Enumerator |
---|
BIT_DStream_unfinished | |
BIT_DStream_endOfBuffer | |
BIT_DStream_completed | |
BIT_DStream_overflow | |
◆ BIT_addBits()
BIT_addBits() : can add up to 31 bits into bitC
. Note : does not check for register overflow !
◆ BIT_addBitsFast()
BIT_addBitsFast() : works only if value
is clean, meaning all high bits above nbBits are 0
◆ BIT_closeCStream()
BIT_closeCStream() :
- Returns
- : size of CStream, in bytes, or 0 if it could not fit into dstBuffer
◆ BIT_endOfDStream()
BIT_endOfDStream() :
- Returns
- : 1 if DStream has exactly reached its end (all bits consumed).
◆ BIT_flushBits()
BIT_flushBits() : assumption : bitContainer has not overflowed safe version; check for buffer overflow, and prevents it. note : does not signal buffer overflow. overflow will be revealed later on using BIT_closeCStream()
◆ BIT_flushBitsFast()
BIT_flushBitsFast() : assumption : bitContainer has not overflowed unsafe version; does not check buffer overflow
◆ BIT_getLowerBits()
◆ BIT_getMiddleBits()
◆ BIT_getUpperBits()
◆ BIT_initCStream()
◆ BIT_initDStream()
BIT_initDStream() : Initialize a BIT_DStream_t. bitD
: a pointer to an already allocated BIT_DStream_t structure. srcSize
must be the exact size of the bitStream, in bytes.
- Returns
- : size of stream (== srcSize), or an errorCode if a problem is detected
◆ BIT_lookBits()
BIT_lookBits() : Provides next n bits from local register. local register is not modified. On 32-bits, maxNbBits==24. On 64-bits, maxNbBits==56.
- Returns
- : value extracted
◆ BIT_lookBitsFast()
◆ BIT_readBits()
BIT_readBits() : Read (consume) next n bits from local register and update. Pay attention to not read more than nbBits contained into local register.
- Returns
- : extracted value.
◆ BIT_readBitsFast()
◆ BIT_reloadDStream()
BIT_reloadDStream() : Refill bitD
from buffer previously set in BIT_initDStream() . This function is safe, it guarantees it will not never beyond src buffer.
- Returns
- : status of
BIT_DStream_t
internal register. when status == BIT_DStream_unfinished, internal register is filled with at least 25 or 57 bits
◆ BIT_reloadDStream_internal()
◆ BIT_reloadDStreamFast()
◆ BIT_skipBits()