1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-10 10:49:54 +00:00

x86 32 bit on windows.

This commit is contained in:
Calvin Rose 2021-02-04 23:31:04 -06:00
parent d374e90033
commit 6839b603c8

View File

@ -307,9 +307,13 @@ int32_t janet_hash(Janet x) {
hash = janet_struct_hash(janet_unwrap_struct(x)); hash = janet_struct_hash(janet_unwrap_struct(x));
break; break;
case JANET_NUMBER: { case JANET_NUMBER: {
uint64_t i = janet_u64(x); union {
uint32_t lo = (uint32_t)(i & 0xFFFFFFFF); double d;
uint32_t hi = (uint32_t)(i >> 32); uint64_t u;
} as;
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));
break; break;
} }