UniRec
2.9.3
|
Definition of structures and functions for handling LINK_BIT_FIELD. Implementation is in unirec.c. It uses link mask (hexadecimal, 64bit long number) to determine which links are used and how they are used. It means, that one can use e.g. 9 links, which do not have to fill ones in LINK_BIT_FIELD on positions 1 - 9 necessary but on positions specified by link mask. More...
#include "inline.h"
Go to the source code of this file.
Data Structures | |
struct | ur_links_t |
Links structure. It contains a link count, link mask and link indexes. Array link_indexes stores positions in LINK_BIT_FIELD for used links (1-n), so one can easily compare LINK_BIT_FIELD with some link, indexed by common indexes 0 - (1-n). More... | |
Macros | |
#define | MAX_LINK_COUNT 64 |
Functions | |
ur_links_t * | ur_create_links (const char *mask) |
Create and initialize links structure. Create new links structure and initialize it from link mask in string format passed by parameter. String link mask is stored in uint64_t, thne link count and link_indexes arrray is determined from it. Structure created by this function should be destroyed by ur_free_links. More... | |
void | ur_free_links (ur_links_t *links) |
Destroy links structure. Free all memory allocated for a links structure created previously by ur_create_links. More... | |
INLINE int | ur_get_link_index (ur_links_t *links, uint64_t link_bit_field) |
Get index of link (0 - (n-1)) Function gets search link_indexes array for value corresponding to passed LINK_BIT_FIELD, which should contains only one "1" value. If more ones are filled in LINK_BIT_FIELD, first from right is taken. Returns index to link_indexes array (from interval 0 - (link_count-1)) or negative value if correspondig value was not found. More... | |
INLINE uint64_t | ur_get_link_bit_field_position (ur_links_t *links, unsigned int index) |
Get position in link_bit_field of link. Get position in link_bit_field of link specified by index of link (from interval 0 - (link_count-1)). This function is inversion to get_link_index. Returns zero if invalid index is passed. More... | |
INLINE uint64_t | ur_get_link_mask (ur_links_t *links) |
Get link mask. More... | |
INLINE unsigned int | ur_get_link_count (ur_links_t *links) |
Get link count. More... | |
Definition of structures and functions for handling LINK_BIT_FIELD. Implementation is in unirec.c. It uses link mask (hexadecimal, 64bit long number) to determine which links are used and how they are used. It means, that one can use e.g. 9 links, which do not have to fill ones in LINK_BIT_FIELD on positions 1 - 9 necessary but on positions specified by link mask.
Definition in file links.h.