pike.git / src / post_modules / CritBit / tree_low.c

version» Context lines:

pike.git/src/post_modules/CritBit/tree_low.c:1:   #include <stdlib.h> - #include <stdint.h> +    #include <sys/types.h>    -  + #include "pike_int_types.h" +    #ifndef HAS___BUILTIN_EXPECT   # define __builtin_expect(x, expected_value) (x)   #endif      #define likely(x) __builtin_expect((x), 1)   #define unlikely(x) __builtin_expect((x), 0)      #ifndef cb_check_node   # define cb_check_node(node) do {} while(0)   #endif
pike.git/src/post_modules/CritBit/tree_low.c:49:    key.len.chars = CB_LENGTH(string);    key.len.bits = 0;    return key;   }      static inline cb_size cb_prefix_count_fallback(const cb_string s1,    const cb_string s2,    const cb_size len,    cb_size start) {    size_t i; -  uint32_t width = MAX(CB_WIDTH(s1), CB_WIDTH(s2)); +  unsigned INT32 width = MAX(CB_WIDTH(s1), CB_WIDTH(s2));       for (i = start.chars; i < len.chars; i++) { -  uint32_t diffbit = CB_COUNT_PREFIX(s1, s2, i); +  unsigned INT32 diffbit = CB_COUNT_PREFIX(s1, s2, i);    start.bits = 0;       if (diffbit < width) { /* are different */   #ifdef ANNOY_DEBUG    fprintf(stderr, "diff in bit %d (byte %d) %d\n", diffbit, i, __LINE__);   #endif    start.chars = i;    start.bits = diffbit;    return start;    }    }       if (len.bits > start.bits) { -  uint32_t diffbit = CB_COUNT_PREFIX(s1, s2, len.chars); +  unsigned INT32 diffbit = CB_COUNT_PREFIX(s1, s2, len.chars);    if (diffbit < len.bits) { /* are different */   #ifdef ANNOY_DEBUG    fprintf(stderr, "diff in bit %d (byte %d) %d\n", diffbit, len.chars, __LINE__);   #endif    start.chars = len.chars;    start.bits = diffbit;    return start;    } else return len;    }   
pike.git/src/post_modules/CritBit/tree_low.c:244:       if (CB_HAS_CHILD(node, 1)) {    b = cb_get_depth(CB_CHILD(node, 1));    }       return len + MAX(b, a);   }      CB_STATIC CB_INLINE cb_node_t cb_subtree_prefix(cb_node_t node, cb_key key) {    cb_size size; -  uint32_t bit; +  unsigned INT32 bit;    size = cb_prefix_count(node->key.str, key.str,    CB_MIN(node->key.len, key.len), size);       if (CB_S_EQ(size, key.len)) { /* key is substring */    return node;    }       bit = CB_GET_BIT(key.str, size);       if (CB_HAS_CHILD(node, bit)) {
pike.git/src/post_modules/CritBit/tree_low.c:266:    }       return NULL;   }      CB_STATIC CB_INLINE void cb_delete(struct cb_tree * tree,    const cb_key key, cb_value * val) {    cb_node_t node = cb_index(tree->root, key);       if (node && CB_HAS_VALUE(node)) { -  uint32_t bit; +  unsigned INT32 bit;    cb_node_t t;    if (val) CB_GET_VALUE(node, val);       CB_RM_VALUE(node);    node->size--;       if (node == tree->root) goto PARENT;       if (!CB_HAS_PARENT(node)) CB_ERROR(("broken tree\n"));   
pike.git/src/post_modules/CritBit/tree_low.c:331:       cb_check_node(tree->root);   }      CB_STATIC CB_INLINE cb_node_t cb_index(const cb_node_t tree, const cb_key key) {    cb_node_t node = tree;    if (tree) cb_check_node(tree);       while (node) {    if (CB_LT(node->key.len, key.len)) { -  uint32_t bit = CB_GET_BIT(key.str, node->key.len); +  unsigned INT32 bit = CB_GET_BIT(key.str, node->key.len);       if (CB_HAS_CHILD(node, bit)) {    node = CB_CHILD(node, bit);    continue;    }    } else if (CB_LT(key.len, node->key.len)) {    return NULL;    } else if (CB_KEY_EQ(node->key, key)) {    cb_check_node(tree);    return node;
pike.git/src/post_modules/CritBit/tree_low.c:497:    cb_node_t new;    size_t bit;       size = cb_prefix_count(node->key.str, key.str,    CB_MIN(node->key.len, key.len), size);       if (CB_S_EQ(size, key.len)) {    cb_node_t klon;       if (CB_S_EQ(size, node->key.len)) { -  uint32_t bit; +  unsigned INT32 bit;       klon = node;    if (CB_HAS_VALUE(klon))    WALK_UP(klon, bit, {    _->size--;    });    else node->size++;    /* remove ref */    /* free_svalue(&node->value); */    CB_SET_KEY(node, key);