ucif/antlr3/src/antlr3collections.c
static  pANTLR3_TRIE_ENTRY
intTrieGet      (pANTLR3_INT_TRIE trie, ANTLR3_INTKEY key)
{
        pANTLR3_INT_TRIE_NODE    thisNode;
        pANTLR3_INT_TRIE_NODE    nextNode;

        if (trie->count == 0)
        {
                return NULL;        /* Nothing in this trie yet */
        }
        /* Starting at the root node in the trie, compare the bit index
         * of the current node with its next child node (starts left from root).
         * When the bit index of the child node is greater than the bit index of the current node
         * then by definition (as the bit index decreases as we descent the trie)
         * we have reached a 'backward' pointer. A backward pointer means we
         * have reached the only node that can be reached by the bits given us so far
         * and it must either be the key we are looking for, or if not then it
         * means the entry was not in the trie, and we return NULL. A backward pointer
         * points back in to the tree structure rather than down (deeper) within the
         * tree branches.
         */
        thisNode        = trie->root;           /* Start at the root node               */
        nextNode        = thisNode->leftN;      /* Examine the left node from the root  */

        /* While we are descending the tree nodes...
         */
        while (thisNode->bitNum > nextNode->bitNum)
        {
                /* Next node now becomes the new 'current' node
                 */
                thisNode    = nextNode;

                /* We now test the bit indicated by the bitmap in the next node
                 * in the key we are searching for. The new next node is the
                 * right node if that bit is set and the left node it is not.
                 */
                if (key & bitMask[nextNode->bitNum])
                {
                        nextNode = nextNode->rightN;    /* 1 is right   */
                }
                else
                {
                        nextNode = nextNode->leftN;             /* 0 is left    */
                }
        }

        /* Here we have reached a node where the bitMap index is lower than
         * its parent. This means it is pointing backward in the tree and
         * must therefore be a terminal node, being the only point than can
         * be reached with the bits seen so far. It is either the actual key
         * we wanted, or if that key is not in the trie it is another key
         * that is currently the only one that can be reached by those bits.
         * That situation would obviously change if the key was to be added
         * to the trie.
         *
         * Hence it only remains to test whether this is actually the key or not.
         */
        if (nextNode->key == key)
        {
                /* This was the key, so return the entry pointer
                 */
                return  nextNode->buckets;
        }
        else
        {
                return  NULL;   /* That key is not in the trie (note that we set the pointer to -1 if no payload) */
        }
}
/** Search the int Trie and return a pointer to the first bucket indexed
 *  by the key if it is contained in the trie, otherwise NULL.
 */
Search the int Trie and return a pointer to the first bucket indexed
by the key if it is contained in the trie, otherwise NULL.
Search the int Trie and return a pointer to the first bucket indexed by the key if it is contained in the trie otherwise NULL .
static  pANTLR3_TRIE_ENTRY
intTrieGet      (pANTLR3_INT_TRIE trie, ANTLR3_INTKEY key)
{
        pANTLR3_INT_TRIE_NODE    thisNode;
        pANTLR3_INT_TRIE_NODE    nextNode;
        if (trie->count == 0)
        {
                return NULL;        
        }
        thisNode        = trie->root;           
        nextNode        = thisNode->leftN;      
        while (thisNode->bitNum > nextNode->bitNum)
        {
                thisNode    = nextNode;
                if (key & bitMask[nextNode->bitNum])
                {
                        nextNode = nextNode->rightN;    
                }
                else
                {
                        nextNode = nextNode->leftN;             
                }
        }
        if (nextNode->key == key)
        {
                return  nextNode->buckets;
        }
        else
        {
                return  NULL;   
        }
}
static pANTLR3_TRIE_ENTRY intTrieGet ( pANTLR3_INT_TRIE trie , ANTLR3_INTKEY key ) { pANTLR3_INT_TRIE_NODE thisNode ; pANTLR3_INT_TRIE_NODE nextNode ; if ( trie -> count == 0 ) { return NULL ; } thisNode = trie -> root ; nextNode = thisNode -> leftN ; while ( thisNode -> bitNum > nextNode -> bitNum ) { thisNode = nextNode ; if ( key & bitMask [ nextNode -> bitNum ] ) { nextNode = nextNode -> rightN ; } else { nextNode = nextNode -> leftN ; } } if ( nextNode -> key == key ) { return nextNode -> buckets ; } else { return NULL ; } }
Search the int Trie and return a pointer to the first bucket indexed
  by the key if it is contained in the trie, otherwise NULL.
Search the int Trie and return a pointer to the first bucket indexed by the key if it is contained in the trie otherwise NULL .
/* Nothing in this trie yet */ /* Starting at the root node in the trie, compare the bit index
         * of the current node with its next child node (starts left from root).
         * When the bit index of the child node is greater than the bit index of the current node
         * then by definition (as the bit index decreases as we descent the trie)
         * we have reached a 'backward' pointer. A backward pointer means we
         * have reached the only node that can be reached by the bits given us so far
         * and it must either be the key we are looking for, or if not then it
         * means the entry was not in the trie, and we return NULL. A backward pointer
         * points back in to the tree structure rather than down (deeper) within the
         * tree branches.
         */ /* Start at the root node               */ /* Examine the left node from the root  */ /* While we are descending the tree nodes...
         */ /* Next node now becomes the new 'current' node
                 */ /* We now test the bit indicated by the bitmap in the next node
                 * in the key we are searching for. The new next node is the
                 * right node if that bit is set and the left node it is not.
                 */ /* 1 is right   */ /* 0 is left    */ /* Here we have reached a node where the bitMap index is lower than
         * its parent. This means it is pointing backward in the tree and
         * must therefore be a terminal node, being the only point than can
         * be reached with the bits seen so far. It is either the actual key
         * we wanted, or if that key is not in the trie it is another key
         * that is currently the only one that can be reached by those bits.
         * That situation would obviously change if the key was to be added
         * to the trie.
         *
         * Hence it only remains to test whether this is actually the key or not.
         */ /* This was the key, so return the entry pointer
                 */ /* That key is not in the trie (note that we set the pointer to -1 if no payload) */