diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-09-11 16:53:51 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-09-11 16:53:51 +0200 |
| commit | bd60ed8df0635f03c87f0f2fdf934d09c3674f28 (patch) | |
| tree | 14f1f1ad9bc0e43ec7d2a6430d2311c22d254105 /src/box32.c | |
| parent | 6b6d20732e6e93066095261f5c3c7a2146668c99 (diff) | |
| download | box64-bd60ed8df0635f03c87f0f2fdf934d09c3674f28.tar.gz box64-bd60ed8df0635f03c87f0f2fdf934d09c3674f28.zip | |
[BOX32] Improved hash<->64bits handling
Diffstat (limited to 'src/box32.c')
| -rw-r--r-- | src/box32.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/box32.c b/src/box32.c index 66967f1c..56ead813 100644 --- a/src/box32.c +++ b/src/box32.c @@ -83,7 +83,7 @@ uintptr_t from_hash_d(ulong_t l) { // Convert from 64bits to hash key, creating it if needed ulong_t to_hash(uintptr_t p) { - if((p<0x100000000LL) && (p&HASH_MSK!=HASH_MSK)) + if((p<0x100000000LL) && ((p&HASH_MSK)!=HASH_MSK)) return (ulong_t)p; if(p==0xffffffffffffffffll) { return 0xffffffff; @@ -101,7 +101,7 @@ ulong_t to_hash(uintptr_t p) { pthread_rwlock_unlock(&hash_lock); pthread_rwlock_wrlock(&hash_lock); ret = HASH_MSK | hash_cnt++; - hash_cnt&=HASH_VAL; + if(hash_cnt==HASH_VAL) hash_cnt = 1; int r; k = kh_put(to, hash_to, p, &r); kh_value(hash_to, k) = ret; @@ -116,7 +116,7 @@ ulong_t to_hash(uintptr_t p) { // Convert from 64bits to hash key and delete the entry from both hash table ulong_t to_hash_d(uintptr_t p) { - if((p<0x100000000LL) && (p&HASH_MSK!=HASH_MSK)) + if((p<0x100000000LL) && ((p&HASH_MSK)!=HASH_MSK)) return (ulong_t)p; if(p==0xffffffffffffffffll) return 0xffffffff; |