diff --git a/src/core/util.c b/src/core/util.c index f7eda236..e472c684 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -225,7 +225,8 @@ int32_t janet_string_calchash(const uint8_t *str, int32_t len) { #endif uint32_t janet_hash_mix(uint32_t input, uint32_t more) { - return input ^ ((more * 2119589369u) + 0x9e3779b9 + (input << 6) + (input >> 2)); + uint32_t mix1 = (more + 0x9e3779b9 + (input << 6) + (input >> 2)); + return input ^ (0x9e3779b9 + (mix1 << 6) + (mix1 >> 2)); } /* Computes hash of an array of values */ diff --git a/src/core/value.c b/src/core/value.c index 74397171..38fae844 100644 --- a/src/core/value.c +++ b/src/core/value.c @@ -324,7 +324,7 @@ int32_t janet_hash(Janet x) { as.d = janet_unwrap_number(x); uint32_t lo = (uint32_t)(as.u & 0xFFFFFFFF); uint32_t hi = (uint32_t)(as.u >> 32); - hash = (int32_t)(hi ^ (lo >> 3)); + hash = (int32_t)((hi ^ (lo >> 3)) * 2654435769u); break; } case JANET_ABSTRACT: {