Skip to content

Commit 0daf351

Browse files
committed
changed hashing function for strings
1 parent 1e2a481 commit 0daf351

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

runtime/hash.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ uint64_t sk_hash_array(stack_t* st, char* obj) {
216216
crc = sk_crc64(crc, obj, len * ty->m_userByteSize);
217217
}
218218
else while(ohead < end) {
219-
size_t size = ty->m_userByteSize;
219+
size_t size = ty->m_userByteSize * len;
220220
size_t slot = 0;
221221
size_t mask_slot = 0;
222222
while(size > 0) {
@@ -245,9 +245,7 @@ uint64_t sk_hash_array(stack_t* st, char* obj) {
245245
uint64_t sk_hash_string(char* obj) {
246246
uint64_t crc = CRC_INIT;
247247
size_t memsize = *(uint32_t*)(obj - 2 * sizeof(uint32_t));
248-
size_t leftsize = 2 * sizeof(uint32_t);
249-
memsize += leftsize;
250-
return sk_crc64(crc, obj-leftsize, memsize);
248+
return sk_crc64(crc, obj, memsize);
251249
}
252250

253251
uint64_t sk_hash_obj(stack_t* st, char* obj) {

0 commit comments

Comments
 (0)