Patricia-Trie impl

Copyright

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.

Author

© 2012 Jörg Seebohn

Files

C-kern/api/ds/inmem/patriciatrie.h

Header file Patricia-Trie.

C-kern/ds/inmem/patriciatrie.c

Implementation file Patricia-Trie impl.

patriciatrie_t

Summary
lifetime
search
GETBITReturns the bit value at bitoffset.
first_different_bitDetermines the first bit which differs in key1 and key2.
change

lifetime

search

GETBIT

Returns the bit value at bitoffset.  Returns (key[0]&0x80) if bitoffset is 0 and (key[0]&0x40) if it is 1 and so on.  Every string has a virtual end marker of 0xFF.  If bitoffset/8 equals therefore length a value of 1 is returned.  If bitoffset is beyond string length and beyond virtual end marker a value of 0 is returned.

first_different_bit

Determines the first bit which differs in key1 and key2.  Virtual end markers of 0xFF at end of each string are considered.  If both keys are equal the functions returns the error code EINVAL.  On success 0 is returned and *bit_offset contains the bit index of the first differing bit beginning with 0.

change

patriciatrie_iterator_t

lifetime

iterate

patriciatrie_prefixiter_t

lifetime

iterate

Functions

test

Patricia Trie Interface.
Implements Patricia-Trie.
Close