From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 05 15:48:58 2017 Received: (at 29132) by debbugs.gnu.org; 5 Nov 2017 20:48:58 +0000 Received: from localhost ([127.0.0.1]:52666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBRqk-0000Ih-Bz for submit@debbugs.gnu.org; Sun, 05 Nov 2017 15:48:58 -0500 Received: from hera.aquilenet.fr ([141.255.128.1]:32789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBRqi-0000IY-9v for 29132@debbugs.gnu.org; Sun, 05 Nov 2017 15:48:56 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 83020E878; Sun, 5 Nov 2017 21:48:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7gmolGggYxFI; Sun, 5 Nov 2017 21:48:56 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 6437DE6B5; Sun, 5 Nov 2017 21:48:55 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Mathieu Othacehe Subject: Re: [bug#29132] [PATCH] system: vm: Use 2^32 - 1 as hash size. References: <1509713344-16963-1-git-send-email-m.othacehe@gmail.com> Date: Sun, 05 Nov 2017 21:48:52 +0100 In-Reply-To: <1509713344-16963-1-git-send-email-m.othacehe@gmail.com> (Mathieu Othacehe's message of "Fri, 3 Nov 2017 13:49:04 +0100") Message-ID: <87bmkgo3ij.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 29132 Cc: 29132@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Hello! Mathieu Othacehe skribis: > * gnu/system/vm.scm (operating-system-uuid): Use 2^32 - 1 instead of > 2^32 as hash size. > > On some 32 bit system (ARM for example), 2^32 exceeds hash max > size (ULONG_MAX =3D 2^32 - 1). > --- > gnu/system/vm.scm | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm > index 3127b30..4424608 100644 > --- a/gnu/system/vm.scm > +++ b/gnu/system/vm.scm > @@ -372,13 +372,13 @@ TYPE (one of 'iso9660 or 'dce). Return a UUID obje= ct." > (bytevector->uuid > (uint-list->bytevector > (list (hash file-system-type > - (expt 2 32)) > + (- (expt 2 32) 1)) =E2=80=98hash=E2=80=99 is documented like this: -- Scheme Procedure: hash key size -- Scheme Procedure: hashq key size -- Scheme Procedure: hashv key size -- C Function: scm_hash (key, size) -- C Function: scm_hashq (key, size) -- C Function: scm_hashv (key, size) Return a hash value for KEY. This is a number in the range 0 to SIZE-1, which is suitable for use in a hash table of the given SIZE. So I take it that you always get something in the range 0=E2=80=932=C2=B3= =C2=B2-1, no? Ludo=E2=80=99.