Showing the changes to src/core/chuck_table.cpp (1 of 24 files). Show all
Unified · Split
| @@ -127,11 +127,11 @@ void TAB_delete( TAB_table t ) · 126 unmodified lines | |||
| 127 | 127 | ||
| 128 | void TAB_enter(TAB_table t, void *key, void *value) | 128 | void TAB_enter(TAB_table t, void *key, void *value) |
| 129 | { | 129 | { |
| 130 | long index; | 130 | t_CKINT index; |
| 131 | unsigned long hval = (unsigned long)key; | 131 | t_CKUINT hval = (t_CKUINT)key; |
| 132 | assert(t && key); | 132 | assert(t && key); |
| 133 | if( t->hash_func ) | 133 | if( t->hash_func ) |
| 134 | hval = (unsigned long)t->hash_func(key); | 134 | hval = (t_CKUINT)t->hash_func(key); |
| 135 | index = hval % t->size; | 135 | index = hval % t->size; |
| 136 | t->table[index] = Binder(key, value, t->table[index], t->top); | 136 | t->table[index] = Binder(key, value, t->table[index], t->top); |
| 137 | t->top = key; | 137 | t->top = key; |
| @@ -139,12 +139,12 @@ void TAB_enter(TAB_table t, void *key, void *value) · 1 unmodified line | |||
| 139 | 139 | ||
| 140 | void *TAB_look(TAB_table t, void *key) | 140 | void *TAB_look(TAB_table t, void *key) |
| 141 | { | 141 | { |
| 142 | long index; | 142 | t_CKINT index; |
| 143 | unsigned long hval = (unsigned long)key; | 143 | t_CKUINT hval = (t_CKUINT)key; |
| 144 | binder b; | 144 | binder b; |
| 145 | assert(t && key); | 145 | assert(t && key); |
| 146 | if( t->hash_func ) | 146 | if( t->hash_func ) |
| 147 | hval = (unsigned long)t->hash_func(key); | 147 | hval = (t_CKUINT)t->hash_func(key); |
| 148 | index= hval % t->size; | 148 | index= hval % t->size; |
| 149 | if( !t->eq_func ) | 149 | if( !t->eq_func ) |
| 150 | { | 150 | { |
| @@ -163,13 +163,13 @@ void *TAB_look(TAB_table t, void *key) · 12 unmodified lines | |||
| 163 | void *TAB_pop(TAB_table t) | 163 | void *TAB_pop(TAB_table t) |
| 164 | { | 164 | { |
| 165 | void *k; binder b; long index; | 165 | void *k; binder b; long index; |
| 166 | unsigned long hval; | 166 | t_CKUINT hval; |
| 167 | assert (t); | 167 | assert (t); |
| 168 | k = t->top; | 168 | k = t->top; |
| 169 | assert (k); | 169 | assert (k); |
| 170 | hval = (unsigned long)k; | 170 | hval = (t_CKUINT)k; |
| 171 | if(t->hash_func) hval = (unsigned long)t->hash_func(k); | 171 | if(t->hash_func) hval = (t_CKUINT)t->hash_func(k); |
| 172 | index = ((unsigned long)hval) % t->size; | 172 | index = hval % t->size; |
| 173 | b = t->table[index]; | 173 | b = t->table[index]; |
| 174 | assert(b); | 174 | assert(b); |
| 175 | t->table[index] = b->next; | 175 | t->table[index] = b->next; |
| @@ -179,13 +179,13 @@ void *TAB_pop(TAB_table t) · 3 unmodified lines | |||
| 179 | 179 | ||
| 180 | void *TAB_topv(TAB_table t) | 180 | void *TAB_topv(TAB_table t) |
| 181 | { | 181 | { |
| 182 | void *k; binder b; long index; | 182 | void *k; binder b; t_CKINT index; |
| 183 | unsigned long hval; | 183 | t_CKUINT hval; |
| 184 | assert(t); | 184 | assert(t); |
| 185 | k = t->top; | 185 | k = t->top; |
| 186 | assert(k); | 186 | assert(k); |
| 187 | hval = (unsigned long)k; | 187 | hval = (t_CKUINT)k; |
| 188 | if(t->hash_func) hval = (unsigned long)t->hash_func(k); | 188 | if(t->hash_func) hval = (t_CKUINT)t->hash_func(k); |
| 189 | index = hval % t->size; | 189 | index = hval % t->size; |
| 190 | b = t->table[index]; | 190 | b = t->table[index]; |
| 191 | assert(b); | 191 | assert(b); |
| @@ -195,7 +195,7 @@ void *TAB_topv(TAB_table t) · 3 unmodified lines | |||
| 195 | void TAB_dump(TAB_table t, void (*show)(void *key, void *value)) | 195 | void TAB_dump(TAB_table t, void (*show)(void *key, void *value)) |
| 196 | { | 196 | { |
| 197 | void *k = t->top; | 197 | void *k = t->top; |
| 198 | long index = ((unsigned long)k) % t->size; | 198 | t_CKINT index = ((t_CKUINT)k) % t->size; |
| 199 | binder b = t->table[index]; | 199 | binder b = t->table[index]; |
| 200 | if (b==NULL) return; | 200 | if (b==NULL) return; |
| 201 | t->table[index]=b->next; | 201 | t->table[index]=b->next; |