mirror of
https://github.com/janet-lang/janet
synced 2024-11-18 06:34:48 +00:00
Address #997 - clang undefined behavior warning.
This commit is contained in:
parent
6a92e8b609
commit
c7801ce277
@ -348,7 +348,7 @@ int32_t janet_hash(Janet x) {
|
|||||||
hash = (int32_t)((hilo << 16) | (hilo >> 16));
|
hash = (int32_t)((hilo << 16) | (hilo >> 16));
|
||||||
} else {
|
} else {
|
||||||
/* Assuming 4 byte pointer (or smaller) */
|
/* Assuming 4 byte pointer (or smaller) */
|
||||||
ptrdiff_t diff = ((char *)janet_unwrap_pointer(x) - (char *)0);
|
uintptr_t diff = janet_unwrap_pointer(x);
|
||||||
uint32_t hilo = (uint32_t) diff * 2654435769u;
|
uint32_t hilo = (uint32_t) diff * 2654435769u;
|
||||||
hash = (int32_t)((hilo << 16) | (hilo >> 16));
|
hash = (int32_t)((hilo << 16) | (hilo >> 16));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user