Replace index_t with uintptr_t

This commit is contained in:
Lassi Kortela 2019-08-09 21:13:48 +03:00
parent c0ef0c2549
commit 5817003816
3 changed files with 9 additions and 11 deletions

View File

@ -133,7 +133,7 @@ void bitvector_shl_to(uint32_t *dest, uint32_t *b, size_t n, uint32_t s,
// assumes offs < 32
void bitvector_fill(uint32_t *b, uint32_t offs, uint32_t c, uint32_t nbits)
{
index_t i;
uintptr_t i;
uint32_t nw, tail;
uint32_t mask;
@ -177,7 +177,7 @@ void bitvector_fill(uint32_t *b, uint32_t offs, uint32_t c, uint32_t nbits)
void bitvector_not(uint32_t *b, uint32_t offs, uint32_t nbits)
{
index_t i;
uintptr_t i;
uint32_t nw, tail;
uint32_t mask;
@ -212,7 +212,7 @@ void bitvector_not(uint32_t *b, uint32_t offs, uint32_t nbits)
void bitvector_##name(uint32_t *dest, uint32_t doffs, uint32_t *src, \
uint32_t soffs, uint32_t nbits) \
{ \
index_t i; \
uintptr_t i; \
uint32_t s, nw, tail, snw; \
uint32_t mask, scrap; \
\
@ -331,7 +331,7 @@ s)
void bitvector_reverse_to(uint32_t *dest, uint32_t *src, uint32_t soffs,
uint32_t nbits)
{
index_t i;
uintptr_t i;
uint32_t nw, tail;
if (nbits == 0)
@ -353,7 +353,7 @@ void bitvector_reverse_to(uint32_t *dest, uint32_t *src, uint32_t soffs,
void bitvector_reverse(uint32_t *b, uint32_t offs, uint32_t nbits)
{
index_t i;
uintptr_t i;
uint32_t nw, tail;
uint32_t *temp;
@ -414,7 +414,7 @@ uint64_t bitvector_count(uint32_t *b, uint32_t offs, uint64_t nbits)
uint32_t bitvector_any0(uint32_t *b, uint32_t offs, uint32_t nbits)
{
index_t i;
uintptr_t i;
uint32_t nw, tail;
uint32_t mask;
@ -452,7 +452,7 @@ uint32_t bitvector_any0(uint32_t *b, uint32_t offs, uint32_t nbits)
uint32_t bitvector_any1(uint32_t *b, uint32_t offs, uint32_t nbits)
{
index_t i;
uintptr_t i;
uint32_t nw, tail;
uint32_t mask;

View File

@ -104,11 +104,9 @@ typedef int bool_t;
#ifdef BITS64
#define TOP_BIT 0x8000000000000000
#define NBITS 64
typedef uint64_t index_t;
#else
#define TOP_BIT 0x80000000
#define NBITS 32
typedef uint32_t index_t;
#endif
#define LLT_ALIGN(x, sz) (((x) + (sz - 1)) & (-sz))

View File

@ -23,7 +23,7 @@
hv = HFUNC((uintptr_t)key); \
retry_bp: \
iter = 0; \
index = (index_t)(hv & (sz - 1)) * 2; \
index = (uintptr_t)(hv & (sz - 1)) * 2; \
sz *= 2; \
orig = index; \
\
@ -99,7 +99,7 @@
size_t sz = hash_size(h); \
size_t maxprobe = max_probe(sz); \
void **tab = h->table; \
size_t index = (index_t)(HFUNC((uintptr_t)key) & (sz - 1)) * 2; \
size_t index = (uintptr_t)(HFUNC((uintptr_t)key) & (sz - 1)) * 2; \
sz *= 2; \
size_t orig = index; \
size_t iter = 0; \