XBinder
Version 2.9.x
|
Bit encode functions. More...
#include "rtxsrc/rtxContext.h"
Go to the source code of this file.
Macros | |
#define | rtxEncByteAlignPattern(pctxt, pattern) |
This macro will byte-align the context buffer by encoding according to the given pattern. More... | |
Functions | |
EXTERNRT int | rtxEncBitsPattern (OSCTXT *pctxt, OSUINT8 pattern, OSSIZE nbits) |
This function encodes the given number of bits using a repeating bit pattern. More... | |
EXTERNRT int | rtxEncBit (OSCTXT *pctxt, OSBOOL value) |
This function will set the bit at the current encode bit cursor position to 1 or 0 and advance the cursor pointer. More... | |
EXTERNRT int | rtxEncBits (OSCTXT *pctxt, OSUINT32 value, OSSIZE nbits) |
This function encodes a number of the least significant bits (up to 32) of an unsigned integer value. More... | |
EXTERNRT int | rtxEncBitsFromSize (OSCTXT *pctxt, OSSIZE value, OSSIZE nbits) |
This function encodes a number of the least significant bits from a size type. More... | |
EXTERNRT int | rtxEncBitsFromByteArray (OSCTXT *pctxt, const OSOCTET *pvalue, OSSIZE nbits) |
This function will encode a series of bits from an octet array. More... | |
EXTERNRT int | rtxCopyBits (OSCTXT *pctxt, const OSOCTET *pvalue, OSSIZE nbits, OSUINT32 bitOffset) |
This function will encode a series of bits from an octet array. More... | |
EXTERNRT int | rtxMergeBits (OSCTXT *pctxt, OSUINT32 value, OSSIZE nbits) |
This function will merge a series of bits (up to 32) from an unsigned integer value into an existing encoded data buffer. More... | |
Bit encode functions.
Definition in file rtxBitEncode.h.
#define rtxEncByteAlignPattern | ( | pctxt, | |
pattern | |||
) |
This macro will byte-align the context buffer by encoding according to the given pattern.
If the buffer is not aligned, the lowest bits of the current byte, which have not be written already, will be set to the corresponding lowest bites of the pattern.
Definition at line 44 of file rtxBitEncode.h.
EXTERNRT int rtxCopyBits | ( | OSCTXT * | pctxt, |
const OSOCTET * | pvalue, | ||
OSSIZE | nbits, | ||
OSUINT32 | bitOffset | ||
) |
This function will encode a series of bits from an octet array.
Encoding started from specified bit offset.
pctxt | Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
pvalue | Pointer to bit string to be encoded. |
nbits | Number of bits from the value to encode. |
bitOffset | Starting bit offset. |
EXTERNRT int rtxEncBit | ( | OSCTXT * | pctxt, |
OSBOOL | value | ||
) |
This function will set the bit at the current encode bit cursor position to 1 or 0 and advance the cursor pointer.
pctxt | Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
value | The value to be encoded. |
EXTERNRT int rtxEncBits | ( | OSCTXT * | pctxt, |
OSUINT32 | value, | ||
OSSIZE | nbits | ||
) |
This function encodes a number of the least significant bits (up to 32) of an unsigned integer value.
pctxt | Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
value | The value to be encoded. |
nbits | Number of bits from the value to encode. |
EXTERNRT int rtxEncBitsFromByteArray | ( | OSCTXT * | pctxt, |
const OSOCTET * | pvalue, | ||
OSSIZE | nbits | ||
) |
This function will encode a series of bits from an octet array.
pctxt | Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
pvalue | Pointer to bit string to be encoded. |
nbits | Number of bits from the value to encode. |
EXTERNRT int rtxEncBitsFromSize | ( | OSCTXT * | pctxt, |
OSSIZE | value, | ||
OSSIZE | nbits | ||
) |
This function encodes a number of the least significant bits from a size type.
The maximum that may be encoded is the maximum held by the type (32 or 64 bits).
pctxt | Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
value | The value to be encoded. |
nbits | Number of bits from the value to encode. |
EXTERNRT int rtxEncBitsPattern | ( | OSCTXT * | pctxt, |
OSUINT8 | pattern, | ||
OSSIZE | nbits | ||
) |
This function encodes the given number of bits using a repeating bit pattern.
This function may be used to encode any number of bits (including more than 8 bits). It will take the bit values to encode from the pattern, in accordance with the buffer's bit offset. For example, if the next bit to encode is the highest bit of the next byte in the buffer, then the bit value encoded will be the highest bit of the pattern.
pctxt | Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
pattern | The repeating pattern. |
bits | The number of bits to encode. |
EXTERNRT int rtxMergeBits | ( | OSCTXT * | pctxt, |
OSUINT32 | value, | ||
OSSIZE | nbits | ||
) |
This function will merge a series of bits (up to 32) from an unsigned integer value into an existing encoded data buffer.
pctxt | Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
value | The value to be encoded. |
nbits | Number of bits from the value to merge. |