GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LDT / V0-3-2
Constituent: encdec     Tag: rad750
#include "PBS/FFS.ih"
Include dependency graph for BFU.h:
This graph shows which files directly or indirectly include this file:
Data Structures | |
struct | _BFU |
The return value of the BFU routines, capturing the current 32-bit word that is being used as a source and the extracted value. More... | |
Defines | |
#define | _bfu_get_pos(_bfu) _bfu.val |
Gets the current buffer bit position. | |
#define | _bfu_get_tmp(_bfu) _bfu.cur |
Gets the current temporary buffer. | |
#define | _bfu_get(_bfu, _tmp, _pos) |
#define | _bfu_put_tmp(_bfu, _tmp) _bfu.cur = _tmp; |
Updates the current temporary buffer. | |
#define | _bfu_put_pos(_bfu, _pos) _bfu.val = _pos; |
Gets the current buffer bit position. | |
#define | _bfu_put(_bfu, _tmp, _pos) |
Updates the current temporary buffer and buffer bit position. | |
#define | _bfu_construct(_bfu, _s, _alignment, _src, _boff) |
Constructs a BFU from an arbitrarily aligned source buffer pointer, and a bit offset _boff. Also returns a 32-bit aligned pointer to be used with _bfu_extract. | |
#define | _bfu_constructW(_bfu, _src, _boff) |
Constructs a BFU from an 32-bit (word) aligned source buffer pointer and a bit offset _boff. | |
#define | _bfu_extractBoolean(_bfu, _wrds, _position) |
Extracts the next bit, returning it as a boolean value. The justification is unspecfied. The implementation is the most efficient of _bfu_extractBL or _bfu_extractBR. Use one of those routine if the justification needs to be specified. | |
#define | _bfu_extractBR(_bfu, _wrds, _position) |
Extracts the right justified bit from the current position. | |
#define | _bfu_extractBL(_bfu, _wrds, _position) |
Extracts the left justified bit from the current position. | |
#define | _bfu_extractL(_bfu, _wrds, _position, _width) |
Extracts a left justified value from the current position. | |
#define | _bfu_extractR(_bfu, _wrds, _position, _width) |
Extracts a right justified value from the current position. | |
#define | _bfu_extract32(_bfu, _wrds, _position) |
Extracts 32 bits from the current position. | |
#define | _bfu_count1s(_bfu, _wrds, _position) |
Counts the number of 1s till the first clear bit. | |
#define | _bfu_revert(_bfu, _wrds, _position, _nwidth, _nexp) |
Counts the number of 1s till the first clear bit. | |
Typedefs | |
typedef _BFU | BFU |
Typedef for struct _BFU. | |
Functions | |
static __inline BFU | BFU__bitL (const unsigned int *wrds, unsigned int cur, unsigned int position) |
Unpacks the left justified bit from the current position. | |
static __inline BFU | BFU__bitR (const unsigned int *wrds, unsigned int cur, unsigned int position) |
Unpacks the right justified bit from the current position. | |
static __inline BFU | BFU__boolean (const unsigned int *wrds, unsigned int cur, unsigned int position) |
Unpacks the next bit. This is equivalent to a bit extract, but the justification (left or right) is unspecified. Rather the must efficient extraction is used, returning only 0 or non-zero. Use BFU__bitL or BFU__bitR if a specific justification is needed. | |
static __inline BFU | BFU__wordR (const unsigned int *wrds, unsigned int cur, unsigned int position, unsigned int width) |
Unpacks a right justified bit field from the current position. The width of the bit field must be less than 32 bits. | |
static __inline BFU | BFU__wordL (const unsigned int *wrds, unsigned int cur, unsigned int position, unsigned int width) |
Unpacks a left justified bit field from the current position. The width of the bit field must be less than 32 bits. | |
static __inline BFU | BFU__word (const unsigned int *wrds, unsigned int cur, unsigned int position) |
Unpacks exactly 32 bits from the current position. | |
static __inline BFU | BFU__ffc (const unsigned int *wrds, unsigned int cur, unsigned int position) |
Scans the input bit stream for the first clear bit, this effectively counts the number of set bits. |
|
Value: do \ { \ /* Move to the nearest 32-bit boundary */ \ \ /* Convert to a 32-bit pointer */ \ _s = (const unsigned int *)_src; \ \ /* Calculate the number of bits that are not a multiple of 32 */ \ alignment = ((int)_s & 0x3) << 3; \ \ /* Add this to the bit offset */ \ _boff += _alignment; \ \ /* Reset the pointer back to the nearest 32-bit boundary */ \ _s = (const unsigned int *)((int)_s & ~0x3); \ \ /* Extract the first word */ \ _bfu.cur = _s[_boff >> 5]; \ _bfu.val = boff; \ \ } while (0)
|
|
Value: _bfu.cur = _src[_boff >> 5]; \ _bfu.val = _boff \
|
|
Value: (_bfu = BFU__ffc (_wrds, _bfu_get_tmp(bfu), _position), \ _position += (_bfu.val -= _position), \ _bfu.val - 1)
|
|
Value: Extracts 32 bits from the current position.
|
|
Value: Extracts the left justified bit from the current position.
|
|
Value: (_bfu = BFU__boolean (_wrds, _bfu.cur, _position), \ _position += 1, \ _bfu.val)
|
|
Value: Extracts the right justified bit from the current position.
|
|
Value: (_bfu = BFU__wordL (_wrds, _bfu.cur, _position, _width), \ _position += _width, \ _bfu.val)
|
|
Value: (_bfu = BFU__wordR (_wrds, _bfu.cur, _position, _width), \ _position += _width, \ _bfu.val)
|
|
Value: _tmp = _bfu.cur; \ _pos = _bfu.val; |
|
Gets the current buffer bit position.
|
|
Gets the current temporary buffer.
|
|
Value: _bfu.cur = _tmp; \ _bfu.val = _pos;
|
|
Gets the current buffer bit position.
|
|
Updates the current temporary buffer.
|
|
Value: ({ \ int val; \ int exp = _bfu_extractR (_bfu, _wrds, _position, _nexp) - 1; \ int nleading = (1 << _nexp) - 1; \ int ntrailing = (_nwidth - nleading > 0) ? _nwidth - nleading : 0; \ int nbits = (exp >= 0) \ ? (exp += ntrailing, val = (1 << exp), exp) \ : (val = 0, exp = ntrailing); \ \ /* printf ("Exp = %2u, Nbits = %2u\n", exp, nbits); */ \ \ /* If any more bits, get them */ \ if (nbits > 0) \ { \ /* printf ("Val = %8.8x -> ", val); */ \ val |= _bfu_extractR (_bfu, _wrds, _position, nbits); \ /* printf ("%8.8x\n", val); */ \ } \ val; \ })
|
|
Unpacks the left justified bit from the current position.
|
|
Unpacks the right justified bit from the current position.
|
|
Unpacks the next bit. This is equivalent to a bit extract, but the justification (left or right) is unspecified. Rather the must efficient extraction is used, returning only 0 or non-zero. Use BFU__bitL or BFU__bitR if a specific justification is needed.
|
|
Scans the input bit stream for the first clear bit, this effectively counts the number of set bits.
|
|
Unpacks exactly 32 bits from the current position.
|
|
Unpacks a left justified bit field from the current position. The width of the bit field must be less than 32 bits.
|
|
Unpacks a right justified bit field from the current position. The width of the bit field must be less than 32 bits.
|