Scribus
Open source desktop publishing at your fingertips
BitStream.h File Reference

PGF bit-stream operations. More...

#include "PGFtypes.h"
Include dependency graph for BitStream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAKEU64(a, b)   ((UINT64) (((UINT32) (a)) | ((UINT64) ((UINT32) (b))) << 32))
 Make 64 bit unsigned integer from two 32 bit unsigned integers.
 

Functions

void SetBit (UINT32 *stream, UINT32 pos)
 
void ClearBit (UINT32 *stream, UINT32 pos)
 
bool GetBit (UINT32 *stream, UINT32 pos)
 
bool CompareBitBlock (UINT32 *stream, UINT32 pos, UINT32 k, UINT32 val)
 
void SetValueBlock (UINT32 *stream, UINT32 pos, UINT32 val, UINT32 k)
 
UINT32 GetValueBlock (UINT32 *stream, UINT32 pos, UINT32 k)
 
void ClearBitBlock (UINT32 *stream, UINT32 pos, UINT32 len)
 
void SetBitBlock (UINT32 *stream, UINT32 pos, UINT32 len)
 
UINT32 SeekBitRange (UINT32 *stream, UINT32 pos, UINT32 len)
 
UINT32 SeekBit1Range (UINT32 *stream, UINT32 pos, UINT32 len)
 
UINT32 AlignWordPos (UINT32 pos)
 
UINT32 NumberOfWords (UINT32 pos)
 

Detailed Description

PGF bit-stream operations.

Author
C. Stamm

Function Documentation

UINT32 AlignWordPos ( UINT32  pos)
inline

Compute bit position of the next 32-bit word

Parameters
poscurrent bit stream position
Returns
bit position of next 32-bit word
void ClearBit ( UINT32 *  stream,
UINT32  pos 
)
inline

Set one bit of a bit stream to 0

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
void ClearBitBlock ( UINT32 *  stream,
UINT32  pos,
UINT32  len 
)
inline

Clear block of size at least len at position pos in stream

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
lenNumber of bits set to 0
bool CompareBitBlock ( UINT32 *  stream,
UINT32  pos,
UINT32  k,
UINT32  val 
)
inline

Compare k-bit binary representation of stream at position pos with val

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
kNumber of bits to compare
valValue to compare with
Returns
true if equal
bool GetBit ( UINT32 *  stream,
UINT32  pos 
)
inline

Return one bit of a bit stream

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
Returns
bit at position pos of bit stream stream
UINT32 GetValueBlock ( UINT32 *  stream,
UINT32  pos,
UINT32  k 
)
inline

Read k-bit number from stream at position pos

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
kNumber of bits to read: 1 <= k <= 32
UINT32 NumberOfWords ( UINT32  pos)
inline

Compute number of the 32-bit words

Parameters
posCurrent bit stream position
Returns
Number of 32-bit words
UINT32 SeekBit1Range ( UINT32 *  stream,
UINT32  pos,
UINT32  len 
)
inline

Returns the distance to the next 0 in stream at position pos. If no 0 is found within len bits, then len is returned.

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
lensize of search area (in bits) return The distance to the next 0 in stream at position pos
UINT32 SeekBitRange ( UINT32 *  stream,
UINT32  pos,
UINT32  len 
)
inline

Returns the distance to the next 1 in stream at position pos. If no 1 is found within len bits, then len is returned.

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
lensize of search area (in bits) return The distance to the next 1 in stream at position pos
void SetBit ( UINT32 *  stream,
UINT32  pos 
)
inline

Set one bit of a bit stream to 1

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
void SetBitBlock ( UINT32 *  stream,
UINT32  pos,
UINT32  len 
)
inline

Set block of size at least len at position pos in stream

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
lenNumber of bits set to 1
void SetValueBlock ( UINT32 *  stream,
UINT32  pos,
UINT32  val,
UINT32  k 
)
inline

Store k-bit binary representation of val in stream at position pos

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
valValue to store in stream at position pos
kNumber of bits of integer representation of val