[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#29132] [PATCH] system: vm: Use 2^32 - 1 as hash size.
From: |
Mathieu Othacehe |
Subject: |
[bug#29132] [PATCH] system: vm: Use 2^32 - 1 as hash size. |
Date: |
Sun, 05 Nov 2017 21:56:13 +0100 |
User-agent: |
mu4e 0.9.18; emacs 25.3.1 |
Hey Ludo,
> So I take it that you always get something in the range 0–2³²-1, no?
Well I agree, but looking to hash code, we have :
--8<---------------cut here---------------start------------->8---
#define FUNC_NAME s_scm_hash
{
unsigned long sz = scm_to_unsigned_integer (size, 1, ULONG_MAX);
--8<---------------cut here---------------end--------------->8---
And 2^32 > ULONG_MAX == 2^32 - 1 on ARM.
This results in this exception :
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (hash 'test (expt 2 32))
ERROR: In procedure hash:
ERROR: Value out of range 1 to 4294967295: 4294967296
--8<---------------cut here---------------end--------------->8---
Mathieu