From bca22f4183ec5a72793ce4775511f3bd19318805 Mon Sep 17 00:00:00 2001 From: Arne Goedeke <el@laramies.com> Date: Sun, 22 Jul 2012 12:48:06 +0200 Subject: [PATCH] ADT.CritBit: use integer types from pike_int_types.h instead --- src/post_modules/CritBit/bitvector.h | 98 +++++++++---------- src/post_modules/CritBit/critbit/key_float.h | 10 +- src/post_modules/CritBit/critbit/key_int.h | 10 +- .../CritBit/critbit/key_pikestring.h | 26 ++--- src/post_modules/CritBit/critbit/key_ptr.h | 6 +- src/post_modules/CritBit/inttree.cmod | 8 +- src/post_modules/CritBit/tree_low.c | 17 ++-- src/post_modules/CritBit/tree_low.h | 6 +- 8 files changed, 91 insertions(+), 90 deletions(-) diff --git a/src/post_modules/CritBit/bitvector.h b/src/post_modules/CritBit/bitvector.h index 8498d0aa72..0f4bb7b24b 100644 --- a/src/post_modules/CritBit/bitvector.h +++ b/src/post_modules/CritBit/bitvector.h @@ -4,7 +4,7 @@ #include "critbit_config.h" #define MOD_PRIME -#include <stdint.h> +#include "pike_int_types.h" #if defined(HAS__BITSCANFORWARD) || defined(HAS__BITSCANFORWARD64) || defined(HAS__BITSCANREVERSE) || defined(HAS__BITSCANREVERSE64) # include <intrin.h> @@ -40,10 +40,10 @@ static const unsigned char LMultiplyDeBruijnBitPosition32[32] = }; /* maps 2^n - 1 -> n */ -static inline uint32_t leading_bit_pos32(const uint32_t v) { - return LMultiplyDeBruijnBitPosition32[(((uint32_t)((v) * 0x07C4ACDDU)) >> 27)]; +static inline unsigned INT32 leading_bit_pos32(const unsigned INT32 v) { + return LMultiplyDeBruijnBitPosition32[(((unsigned INT32)((v) * 0x07C4ACDDU)) >> 27)]; } -static inline uint32_t trailing_bit_pos32(const uint32_t v) { +static inline unsigned INT32 trailing_bit_pos32(const unsigned INT32 v) { return 31 - leading_bit_pos32(v); } #if SIZEOF_LONG == 8 || SIZEOF_LONG_LONG == 8 @@ -58,16 +58,16 @@ static const unsigned char TMultiplyDeBruijnBitPosition64[64] = { 7, 18, 38, 32, 28, 47, 54, 51, 19, 39, 48, 55, 40, 56, 57, 58 }; -static inline uint64_t trailing_bit_pos64(const uint64_t v) { - return TMultiplyDeBruijnBitPosition64[(((uint64_t)((v) * 0x07EDD5E59A4E28C2ULL)) >> 58)]; +static inline unsigned INT64 trailing_bit_pos64(const unsigned INT64 v) { + return TMultiplyDeBruijnBitPosition64[(((unsigned INT64)((v) * 0x07EDD5E59A4E28C2ULL)) >> 58)]; } -static inline uint64_t leading_bit_pos64(const uint64_t v) { +static inline unsigned INT64 leading_bit_pos64(const unsigned INT64 v) { return 63 - trailing_bit_pos64(v); } #endif -static inline uint32_t round_up32_(uint32_t v) { +static inline unsigned INT32 round_up32_(unsigned INT32 v) { v |= v >> 1; /* first round down to one less than a power of 2 */ v |= v >> 2; v |= v >> 4; @@ -76,15 +76,15 @@ static inline uint32_t round_up32_(uint32_t v) { return v; } -static inline uint32_t round_up32(const uint32_t v) { +static inline unsigned INT32 round_up32(const unsigned INT32 v) { return round_up32_(v)+1; } -static inline uint32_t round_down32(const uint32_t v) { +static inline unsigned INT32 round_down32(const unsigned INT32 v) { return round_up32(v-1); } -static inline uint64_t round_up64_(uint64_t v) { +static inline unsigned INT64 round_up64_(unsigned INT64 v) { v |= v >> 1; /* first round down to one less than a power of 2 */ v |= v >> 2; v |= v >> 4; @@ -94,31 +94,31 @@ static inline uint64_t round_up64_(uint64_t v) { return v; } -static inline uint64_t round_up64(const uint64_t v) { +static inline unsigned INT64 round_up64(const unsigned INT64 v) { return round_up64_(v) + 1; } -static inline uint64_t round_down64(const uint64_t v) { +static inline unsigned INT64 round_down64(const unsigned INT64 v) { return round_up64(v-1); } #ifdef HAS___BUILTIN_CLZ -# define clz32(i) ((uint32_t)(!(i) ? 32 : __builtin_clz((uint32_t)i))) +# define clz32(i) ((unsigned INT32)(!(i) ? 32 : __builtin_clz((unsigned INT32)i))) #elif defined(HAS__BIT_SCAN_REVERSE) -# define clz32(i) ((uint32_t)(!(i) ? 32 : _bit_scan_reverse((int)i))) +# define clz32(i) ((unsigned INT32)(!(i) ? 32 : _bit_scan_reverse((int)i))) #elif defined(HAS___CNTLZ4) -# define clz32(i) ((uint32_t)__cntlz4(i)) +# define clz32(i) ((unsigned INT32)__cntlz4(i)) #elif defined(HAS__BITSCANREVERSE) -static inline uint32_t clz32(const uint32_t i) { +static inline unsigned INT32 clz32(const unsigned INT32 i) { static unsigned long index; if (_BitScanReverse(&index, (unsigned long)i)) - return (uint32_t)index; + return (unsigned INT32)index; return 32; } #else -static inline uint32_t clz32(const uint32_t y) { +static inline unsigned INT32 clz32(const unsigned INT32 y) { #ifdef MOD_PRIME - register uint32_t t; + register unsigned INT32 t; if ((t = y >> 24)) { return 8 - logTable[t]; @@ -135,61 +135,61 @@ static inline uint32_t clz32(const uint32_t y) { } #endif -#define clz16(i) ((uint32_t)(!(i) ? 16 : clz32((uint32_t)i)-16)) -#define clz8(i) ((char)(!(i) ? 8 : clz32((uint32_t)i)-24)) +#define clz16(i) ((unsigned INT32)(!(i) ? 16 : clz32((unsigned INT32)i)-16)) +#define clz8(i) ((char)(!(i) ? 8 : clz32((unsigned INT32)i)-24)) #ifdef HAS___BUILTIN_CTZ -# define ctz32(i) ((uint32_t)(!(i) ? 32 : __builtin_ctz((uint32_t)i))) +# define ctz32(i) ((unsigned INT32)(!(i) ? 32 : __builtin_ctz((unsigned INT32)i))) #elif defined(HAS__BIT_SCAN_FORWARD) -# define ctz32(i) ((uint32_t)(!(i) ? 32 : _bit_scan_forward((int)i))) +# define ctz32(i) ((unsigned INT32)(!(i) ? 32 : _bit_scan_forward((int)i))) #elif defined(HAS___CNTTZ4) -# define ctz32(i) ((uint32_t)__cnttz4(i)) +# define ctz32(i) ((unsigned INT32)__cnttz4(i)) #elif defined(HAS__BITSCANFORWARD) -static inline uint32_t ctz32(const uint32_t i) { +static inline unsigned INT32 ctz32(const unsigned INT32 i) { static unsigned long index; if (_BitScanForward(&index, (unsigned long)i)) - return (uint32_t)index; + return (unsigned INT32)index; return 32; } #else -static inline uint32_t ctz32(const uint32_t i) { +static inline unsigned INT32 ctz32(const unsigned INT32 i) { #ifdef MOD_PRIME /* this table maps (2^n % 37) to n */ static const char ctz32Table[37] = { 32, 0, 1, 26, 2, 23, 27, -1, 3, 16, 24, 30, 28, 11, -1, 13, 4, 7, 17, -1, 25, 22, 31, 15, 29, 10, 12, 6, -1, 21, 14, 9, 5, 20, 8, 19, 18 }; - return (uint32_t)ctz32Table[((uint32_t)((int)i & -(int)i))%37]; + return (unsigned INT32)ctz32Table[((unsigned INT32)((int)i & -(int)i))%37]; #else - return i ? trailing_bit_pos32((uint32_t)((int)i & -(int)i)) : 32; + return i ? trailing_bit_pos32((unsigned INT32)((int)i & -(int)i)) : 32; #endif } #endif -#define ctz16(i) ((uint32_t)(!(i) ? 16 : ctz32((uint32_t)i)-16)) -#define ctz8(i) ((char)(!(i) ? 8 : ctz32((uint32_t)i)-24)) +#define ctz16(i) ((unsigned INT32)(!(i) ? 16 : ctz32((unsigned INT32)i)-16)) +#define ctz8(i) ((char)(!(i) ? 8 : ctz32((unsigned INT32)i)-24)) #if SIZEOF_LONG == 8 || SIZEOF_LONG_LONG == 8 # if SIZEOF_LONG == 8 && defined(HAS___BUILTIN_CLZL) -# define clz64(x) ((uint32_t)(!(x) ? 64\ +# define clz64(x) ((unsigned INT32)(!(x) ? 64\ : __builtin_clzl((unsigned long)(x)))) # elif SIZEOF_LONG_LONG == 8 && defined(HAS___BUILTIN_CLZLL) -# define clz64(x) ((uint32_t)(!(x) ? 64\ +# define clz64(x) ((unsigned INT32)(!(x) ? 64\ : __builtin_clzll((unsigned long long)(x)))) # elif defined(HAS___CNTLZ8) -# define clz64(x) ((uint32_t)__cntlz8(x)) +# define clz64(x) ((unsigned INT32)__cntlz8(x)) # elif defined(HAS__BITSCANREVERSE64) -static inline uint32_t clz64(const uint64_t i) { +static inline unsigned INT32 clz64(const unsigned INT64 i) { static unsigned long index; if (_BitScanReverse64(&index, (__int64)i)) - return (uint32_t)index; + return (unsigned INT32)index; return 64; } # else -static inline uint32_t clz64(const uint64_t y) { +static inline unsigned INT32 clz64(const unsigned INT64 y) { #ifdef MOD_PRIME - register uint64_t t; + register unsigned INT64 t; if ((t = y >> 56)) { return 8 - logTable[t]; @@ -216,25 +216,25 @@ static inline uint32_t clz64(const uint64_t y) { # endif # if SIZEOF_LONG == 8 && defined(HAS___BUILTIN_CTZL) -# define ctz64(x) ((uint32_t)(!(x) ? 64\ +# define ctz64(x) ((unsigned INT32)(!(x) ? 64\ : __builtin_ctzl((unsigned long)(x)))) /* # warning __builtin_ctzl used */ # elif SIZEOF_LONG_LONG == 8 && defined(HAS___BUILTIN_CTZLL) -# define ctz64(x) ((uint32_t)(!(x) ? 64\ +# define ctz64(x) ((unsigned INT32)(!(x) ? 64\ : __builtin_ctzll((unsigned long long)(x)))) /* # warning __builtin_ctzll used */ # elif defined(HAS___CNTTZ8) -# define ctz64(x) ((uint32_t)__cnttz8(x)) +# define ctz64(x) ((unsigned INT32)__cnttz8(x)) /* # warning __cnttz8 used */ # elif defined(HAS__BITSCANFORWARD64) -static inline uint32_t ctz64(const uint64_t i) { +static inline unsigned INT32 ctz64(const unsigned INT64 i) { static unsigned long index; if (_BitScanForward64(&index, (__int64)i)) - return (uint32_t)index; + return (unsigned INT32)index; return 64; } # else -static inline uint32_t ctz64(const uint64_t i) { +static inline unsigned INT32 ctz64(const unsigned INT64 i) { #ifdef MOD_PRIME /* this table maps (2^n % 67) to n */ static const char ctz64Table[67] = { @@ -243,9 +243,9 @@ static inline uint32_t ctz64(const uint64_t i) { 22, 11, 58, 18, 53, 63, 9, 61, 27, 29, 50, 43, 46, 31, 37, 21, 57, 52, 8, 26, 49, 45, 36, 56, 7, 48, 35, 6, 34, 33 }; - return (uint32_t)ctz64Table[((uint64_t)((int64_t)i & -(int64_t)i))%67]; + return (unsigned INT32)ctz64Table[((unsigned INT64)((INT64)i & -(INT64)i))%67]; #else - return i ? trailing_bit_pos64((uint64_t)((int64_t)i & -(int64_t)i)) : 64; + return i ? trailing_bit_pos64((unsigned INT64)((INT64)i & -(INT64)i)) : 64; #endif } # endif @@ -278,8 +278,8 @@ static inline uint32_t ctz64(const uint64_t i) { # elif defined(HAS__BYTESWAP_UINT64) # define hton64(x) _byteswap_uint64((unsigned __int64)x) # else -# define hton64(x) ((int64_t)hton32((int)((x) >> 32))\ - | (((int64_t)hton32((int)((x) & 0x00000000ffffffff))) << 32)) +# define hton64(x) ((INT64)hton32((int)((x) >> 32))\ + | (((INT64)hton32((int)((x) & 0x00000000ffffffff))) << 32)) # endif # else /* PIKE_BYTEORDER = 1234 */ /* # warning "big endian" */ diff --git a/src/post_modules/CritBit/critbit/key_float.h b/src/post_modules/CritBit/critbit/key_float.h index 26514d196b..4217b5a24d 100644 --- a/src/post_modules/CritBit/critbit/key_float.h +++ b/src/post_modules/CritBit/critbit/key_float.h @@ -1,15 +1,15 @@ #ifndef CB_FLOAT_H #define CB_FLOAT_H -#include <stdint.h> #include <math.h> #include "bitvector.h" +#include "pike_int_types.h" #if SIZEOF_FLOAT_TYPE == 8 -typedef uint64_t CB_NAME(string); -typedef uint64_t CB_NAME(char); +typedef unsigned INT64 CB_NAME(string); +typedef unsigned INT64 CB_NAME(char); #else -typedef uint32_t CB_NAME(string); -typedef uint32_t CB_NAME(char); +typedef unsigned INT32 CB_NAME(string); +typedef unsigned INT32 CB_NAME(char); #endif diff --git a/src/post_modules/CritBit/critbit/key_int.h b/src/post_modules/CritBit/critbit/key_int.h index db8dc39f1a..efd6950cc3 100644 --- a/src/post_modules/CritBit/critbit/key_int.h +++ b/src/post_modules/CritBit/critbit/key_int.h @@ -1,14 +1,14 @@ #ifndef CB_KEY_PIKEINT_H #define CB_KEY_PIKEINT_H -#include <stdint.h> #include "bitvector.h" +#include "pike_int_types.h" #if SIZEOF_INT_TYPE == 4 -typedef uint32_t CB_NAME(string); -typedef uint32_t CB_NAME(char); +typedef unsigned INT32 CB_NAME(string); +typedef unsigned INT32 CB_NAME(char); #else -typedef uint64_t CB_NAME(string); -typedef uint64_t CB_NAME(char); +typedef unsigned INT64 CB_NAME(string); +typedef unsigned INT64 CB_NAME(char); #endif #ifdef cb_char diff --git a/src/post_modules/CritBit/critbit/key_pikestring.h b/src/post_modules/CritBit/critbit/key_pikestring.h index 724e2347a9..68623794ae 100644 --- a/src/post_modules/CritBit/critbit/key_pikestring.h +++ b/src/post_modules/CritBit/critbit/key_pikestring.h @@ -1,7 +1,7 @@ #ifndef CB_KEY_PIKESTRING_H #define CB_KEY_PIKESTRING_H -#include <stdint.h> #include "bitvector.h" +#include "pike_int_types.h" typedef struct pike_string * CB_NAME(string); typedef p_wchar2 CB_NAME(char); @@ -33,7 +33,7 @@ typedef p_wchar2 CB_NAME(char); #define CB_SIZE(key) ((key).len) #define CB_GET_BIT(str, pos) \ (BITN(cb_char, CB_GET_CHAR((str), (pos).chars), (pos).bits)) -static inline uint32_t CB_COUNT_PREFIX(const cb_string s1, const cb_string s2, const size_t n) { +static inline unsigned INT32 CB_COUNT_PREFIX(const cb_string s1, const cb_string s2, const size_t n) { cb_char c; c = CB_GET_CHAR(s1, n); c ^= CB_GET_CHAR(s2, n); @@ -66,19 +66,19 @@ static inline cb_size cb_prefix_count_wide0(const cb_string s1, #endif #define PREFIX(n) do { \ - size_t k = j/sizeof(uint ##n ##_t); \ - for (;k < len.chars/sizeof(uint ##n ##_t);k++) { \ - uint ##n ##_t x = ((uint ##n ##_t *)p1)[k] \ - ^ ((uint ##n ##_t *)p2)[k]; \ + size_t k = j/sizeof(unsigned INT ##n ); \ + for (;k < len.chars/sizeof(unsigned INT ##n );k++) { \ + unsigned INT ##n x = ((unsigned INT ##n *)p1)[k] \ + ^ ((unsigned INT ##n *)p2)[k]; \ if (x) { \ - uint32_t a; \ + unsigned INT32 a; \ a = clz ##n(hton ##n(x)); \ - start.chars = k*sizeof(uint ##n ##_t) + a/8; \ + start.chars = k*sizeof(unsigned INT ##n ) + a/8; \ start.bits = 24 + a % 8; \ return start; \ } \ } \ - j = k*sizeof(uint ##n ##_t); \ + j = k*sizeof(unsigned INT ##n); \ } while(0) #ifdef lzc64 PREFIX(64); @@ -97,7 +97,7 @@ static inline cb_size cb_prefix_count_wide0(const cb_string s1, start.chars = j; if (len.bits) { - uint32_t a = clz8(((p_wchar0*)p1)[j]^((p_wchar0*)p2)[j]); + unsigned INT32 a = clz8(((p_wchar0*)p1)[j]^((p_wchar0*)p2)[j]); start.bits = MINIMUM(len.bits, 24+a); return start; } @@ -133,10 +133,10 @@ static inline cb_size cb_prefix_count_widestring(const cb_string s1, s1->str, s1, s2->str, s2, t.chars, t.bits, r.chars, r.bits, len.chars, len.bits, start.chars, start.bits); fprintf(stderr, "here you die: %p, %lu\n", chrptr, - r.bits/(uint64_t)zero); + r.bits/(unsigned INT64)zero); fprintf(stderr, "%p %p %p", zero, n1, n2); - n1 = n2 = (void*)(zero = (uint64_t)chrptr ^ (uint64_t)n1 - ^ (uint64_t)n2); + n1 = n2 = (void*)(zero = (unsigned INT64)chrptr ^ (unsigned INT64)n1 + ^ (unsigned INT64)n2); fprintf(stderr, "%p %p %p %p %p %p", zero, n1, n2, rp, (void*)rp, tp, (void*)tp); } diff --git a/src/post_modules/CritBit/critbit/key_ptr.h b/src/post_modules/CritBit/critbit/key_ptr.h index 1f80ca4b87..10acd5f9e8 100644 --- a/src/post_modules/CritBit/critbit/key_ptr.h +++ b/src/post_modules/CritBit/critbit/key_ptr.h @@ -1,8 +1,8 @@ #ifndef CB_KEY_PTR_H #define CB_KEY_PTR_H -#include <stdint.h> #include <sys/types.h> #include "global.h" +#include "pike_int_types.h" #include "bitvector.h" @@ -11,10 +11,10 @@ #endif #if SIZEOF_CHAR_P == 8 -# define _VOIDP_TYPE uint64_t +# define _VOIDP_TYPE unsigned INT64 # define gclz(x) clz64(x) #elif SIZEOF_CHAR_P == 4 -# define _VOIDP_TYPE uint32_t +# define _VOIDP_TYPE unsigned INT64 # define gclz(x) clz32(x) #else # error UNKNOWN POINTER SIZE diff --git a/src/post_modules/CritBit/inttree.cmod b/src/post_modules/CritBit/inttree.cmod index 9cc6961dce..0fb75550af 100644 --- a/src/post_modules/CritBit/inttree.cmod +++ b/src/post_modules/CritBit/inttree.cmod @@ -49,7 +49,7 @@ PIKECLASS IntTree { cb_key cb_key_from_ptype_ipv4(struct pike_string * s) { cb_key key; - uint32_t a, b, c, d, e; + unsigned INT32 a, b, c, d, e; key.len.chars = 1; key.len.bits = 0; @@ -78,12 +78,12 @@ struct pike_string * cb_ptype_from_key_ipv4(cb_key key) { char buf[19]; size_t len; - uint32_t ip = (uint32_t)key.str; + unsigned INT32 ip = (unsigned INT32)key.str; if (key.len.bits || !key.len.chars) { ip &= (~0U) << (32 - key.len.bits); len = snprintf(buf, 19, "%u.%u.%u.%u/%u", ip>>24, (ip>>16)&0xff, - (ip>>8)&0xff, ip&0xff, (uint32_t)(key.len.bits + (ip>>8)&0xff, ip&0xff, (unsigned INT32)(key.len.bits - WASTED_BITS)); } else { len = snprintf(buf, 19, "%u.%u.%u.%u", ip>>24, (ip>>16)&0xff, @@ -139,7 +139,7 @@ PIKECLASS IPv4Tree { } PIKEFUN int umask(int n) { - RETURN MASK(uint64_t, n); + RETURN MASK(unsigned INT64, n); } PIKEFUN int cmp_key(mixed a, mixed b) { diff --git a/src/post_modules/CritBit/tree_low.c b/src/post_modules/CritBit/tree_low.c index 21ae6871a5..88e39d13ad 100644 --- a/src/post_modules/CritBit/tree_low.c +++ b/src/post_modules/CritBit/tree_low.c @@ -1,7 +1,8 @@ #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 @@ -56,10 +57,10 @@ static inline cb_size cb_prefix_count_fallback(const cb_string s1, 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 */ @@ -73,7 +74,7 @@ static inline cb_size cb_prefix_count_fallback(const cb_string s1, } 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__); @@ -251,7 +252,7 @@ CB_STATIC CB_INLINE size_t cb_get_depth(cb_node_t node) { 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); @@ -273,7 +274,7 @@ CB_STATIC CB_INLINE void cb_delete(struct cb_tree * tree, 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); @@ -338,7 +339,7 @@ CB_STATIC CB_INLINE cb_node_t cb_index(const cb_node_t tree, const cb_key key) { 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); @@ -504,7 +505,7 @@ static inline int cb_low_insert(struct cb_tree * tree, 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)) diff --git a/src/post_modules/CritBit/tree_low.h b/src/post_modules/CritBit/tree_low.h index 7476f72a3c..9234c1d3a7 100644 --- a/src/post_modules/CritBit/tree_low.h +++ b/src/post_modules/CritBit/tree_low.h @@ -38,7 +38,7 @@ #define CB_SET_CHILD(__parent, __bit, __child) do { \ cb_node_t _p = (__parent); \ cb_node_t _child = (__child); \ - uint32_t _bit = (__bit); \ + unsigned INT32 _bit = (__bit); \ if (_child) _child->parent = _p; \ CB_CHILD(_p, _bit) = _child; \ } while(0) @@ -66,7 +66,7 @@ if (CB_HAS_CHILD(_, 0)) { _ = CB_CHILD(_, 0); } \ else if (CB_HAS_CHILD(_, 1)) { _ = CB_CHILD(_, 1); } \ else { \ - uint32_t hit = 0, oldbit = 3; \ + unsigned INT32 hit = 0, oldbit = 3; \ WALK_UP(_, oldbit, { \ /*printf("one step up: %d\n", oldbit); \ printf("one step forward: %d %d %d\n", CB_HAS_PARENT(_), @@ -87,7 +87,7 @@ /*printf("one step forward: %d %d %d\n", * CB_HAS_PARENT(_), CB_HAS_CHILD(_, 0), CB_HAS_CHILD(_, 1));*/ \ if (CB_HAS_PARENT(_)) { \ - uint32_t bit = CB_BIT(_); \ + unsigned INT32 bit = CB_BIT(_); \ _ = CB_PARENT(_); \ if (bit && CB_HAS_CHILD(_, 0)) { \ _ = CB_CHILD(_, 0); \ -- GitLab