SphinxBase 5prealpha
|
An implementation bit array - memory efficient storage for digit int and float data. More...
Go to the source code of this file.
Data Structures | |
struct | bitarr_mask_s |
Structure that specifies bits required to efficiently store certain data. More... | |
struct | bitarr_address_s |
Structure that stores address of certain value in bit array. More... | |
Typedefs | |
typedef struct bitarr_mask_s | bitarr_mask_t |
Structure that specifies bits required to efficiently store certain data. | |
typedef struct bitarr_address_s | bitarr_address_t |
Structure that stores address of certain value in bit array. | |
Functions | |
SPHINXBASE_EXPORT uint64 | bitarr_read_int57 (bitarr_address_t address, uint8 length, uint64 mask) |
Read uint64 value from bit array. | |
SPHINXBASE_EXPORT void | bitarr_write_int57 (bitarr_address_t address, uint8 length, uint64 value) |
Write specified value into bit array. | |
SPHINXBASE_EXPORT uint32 | bitarr_read_int25 (bitarr_address_t address, uint8 length, uint32 mask) |
Read uint32 value from bit array. | |
SPHINXBASE_EXPORT void | bitarr_write_int25 (bitarr_address_t address, uint8 length, uint32 value) |
Write specified value into bit array. | |
SPHINXBASE_EXPORT void | bitarr_mask_from_max (bitarr_mask_t *bit_mask, uint32 max_value) |
Fills mask for certain int range according to provided max value. | |
SPHINXBASE_EXPORT uint8 | bitarr_required_bits (uint32 max_value) |
Computes amount of bits required ti store integers upto value provided. | |
An implementation bit array - memory efficient storage for digit int and float data.
Implementation of basic operations of read/write digits consuming as little space as possible.
Definition in file bitarr.h.
SPHINXBASE_EXPORT void bitarr_mask_from_max | ( | bitarr_mask_t * | bit_mask, |
uint32 | max_value ) |
Fills mask for certain int range according to provided max value.
bit_mask | mask that is filled |
max_value | bigest integer that is going to be stored using this mask |
Definition at line 125 of file bitarr.c.
References bitarr_mask_from_max(), and bitarr_required_bits().
Referenced by bitarr_mask_from_max().
SPHINXBASE_EXPORT uint32 bitarr_read_int25 | ( | bitarr_address_t | address, |
uint8 | length, | ||
uint32 | mask ) |
Read uint32 value from bit array.
Assumes mask == (1 << length) - 1 where length <= 25
address | to read from |
length | number of bits for value |
mask | of read value |
Definition at line 100 of file bitarr.c.
References bitarr_read_int25().
Referenced by bitarr_read_int25().
SPHINXBASE_EXPORT uint64 bitarr_read_int57 | ( | bitarr_address_t | address, |
uint8 | length, | ||
uint64 | mask ) |
Read uint64 value from bit array.
Assumes mask == (1 << length) - 1 where length <= 57
address | to read from |
length | number of bits for value |
mask | of read value |
Definition at line 82 of file bitarr.c.
References bitarr_read_int57().
Referenced by bitarr_read_int57().
SPHINXBASE_EXPORT uint8 bitarr_required_bits | ( | uint32 | max_value | ) |
Computes amount of bits required ti store integers upto value provided.
max_value | bigest integer that going to be stored using this amount of bits |
Definition at line 131 of file bitarr.c.
References bitarr_required_bits().
Referenced by bitarr_mask_from_max(), and bitarr_required_bits().
SPHINXBASE_EXPORT void bitarr_write_int25 | ( | bitarr_address_t | address, |
uint8 | length, | ||
uint32 | value ) |
Write specified value into bit array.
Assumes value < (1 << length) and length <= 25. Assumes the memory is zero initially.
address | in bit array ti write to |
length | amount of active bytes in value to write |
value | integer to write |
Definition at line 112 of file bitarr.c.
References bitarr_write_int25().
Referenced by bitarr_write_int25().
SPHINXBASE_EXPORT void bitarr_write_int57 | ( | bitarr_address_t | address, |
uint8 | length, | ||
uint64 | value ) |
Write specified value into bit array.
Assumes value < (1 << length) and length <= 57. Assumes the memory is zero initially.
address | to write to |
length | amount of active bytes in value to write |
value | integer to write |
Definition at line 87 of file bitarr.c.
References bitarr_write_int57().
Referenced by bitarr_write_int57().