all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mathieu Othacehe <m.othacehe@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 29132@debbugs.gnu.org
Subject: [bug#29132] [PATCH] system: vm: Use 2^32 - 1 as hash size.
Date: Sun, 05 Nov 2017 21:56:13 +0100	[thread overview]
Message-ID: <87shdsmolu.fsf@gmail.com> (raw)
In-Reply-To: <87bmkgo3ij.fsf@gnu.org>


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

  reply	other threads:[~2017-11-05 20:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 12:49 [bug#29132] [PATCH] system: vm: Use 2^32 - 1 as hash size Mathieu Othacehe
2017-11-05 20:48 ` Ludovic Courtès
2017-11-05 20:56   ` Mathieu Othacehe [this message]
2017-11-06  8:41     ` Ludovic Courtès
2017-11-06 19:04       ` Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shdsmolu.fsf@gmail.com \
    --to=m.othacehe@gmail.com \
    --cc=29132@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.