Implements array which supports strings as index values.
ArraySTF impl | Implements array which supports strings as index values. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file ArraySTF. |
C-kern/ | Implementation file ArraySTF impl. |
arraystf_node_t | |
static variables | |
s_arraystf_errtimer | Simulates an error in different functions. |
helper | |
compiletime_assert | Checks that arraystf_node_t can be castet into string_t. |
arraystf_keyval_t | Describes the value of a key string at a certain memory offset. |
Functions | |
init_arraystfkeyval | Loads next key data byte at offset from node into keyval. |
initdiff_arraystfkeyval | Searches the first position where the two keys differ. |
arraystf_t | |
helper | |
lifetime | |
query | |
change | |
arraystf_iterator_t | |
test |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2011 Jörg Seebohn
Header file ArraySTF.
Implementation file ArraySTF impl.
static variables | |
s_arraystf_errtimer | Simulates an error in different functions. |
helper | |
compiletime_assert | Checks that arraystf_node_t can be castet into string_t. |
static inline void compiletime_assert( void )
Checks that arraystf_node_t can be castet into string_t.
struct arraystf_keyval_t
Describes the value of a key string at a certain memory offset.
Functions | |
init_arraystfkeyval | Loads next key data byte at offset from node into keyval. |
initdiff_arraystfkeyval | Searches the first position where the two keys differ. |
static void init_arraystfkeyval( /*out*/arraystf_keyval_t * keyval, size_t offset, arraystf_node_t * node )
Loads next key data byte at offset from node into keyval. The key is defined to be 0 at offsets beyond arraystf_node_t.size. The special offset (-1) returns in keyval the length of the key. This special key encoding ensures that no key is a prefix of another (longer) key.
static int initdiff_arraystfkeyval( /*out*/arraystf_keyval_t * keyval, arraystf_node_t * node, arraystf_node_t * key )
Searches the first position where the two keys differ. This position is returned in keyval as offset and data value. The returned data value is result of the the xor operation between the two key values at the computed offset.
The xor operation is chosen so that the first differing bit generates a set bit in <arraystf_keyval_t.data>. With log2_int it is possible to compute the bit index and to determine the value of arraystf_mwaybranch_t.shift.
Simulates an error in different functions.
static test_errortimer_t s_arraystf_errtimer
Checks that arraystf_node_t can be castet into string_t.
static inline void compiletime_assert( void )
Describes the value of a key string at a certain memory offset.
struct arraystf_keyval_t
Loads next key data byte at offset from node into keyval.
static void init_arraystfkeyval( /*out*/arraystf_keyval_t * keyval, size_t offset, arraystf_node_t * node )
Searches the first position where the two keys differ.
static int initdiff_arraystfkeyval( /*out*/arraystf_keyval_t * keyval, arraystf_node_t * node, arraystf_node_t * key )
Length of key in memory in bytes.
size_t size
Index of bit of key data byte at position offset used to branch.
uint8_t shift