From 92394119721e6a581c344fa5c0e47faa9283ddef Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 27 Apr 2011 17:43:18 -0700 Subject: [PATCH] * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long. --- src/ChangeLog | 4 ++++ src/fns.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 567c1251480..a43e61f8278 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-04-28 Paul Eggert + + * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long. + 2011-04-27 Paul Eggert * doprnt.c (doprnt): Support "ll" length modifier, for long long. diff --git a/src/fns.c b/src/fns.c index a128b9292c6..47ded456c6e 100644 --- a/src/fns.c +++ b/src/fns.c @@ -75,7 +75,7 @@ Other values of LIMIT are ignored. */) { EMACS_INT val; Lisp_Object lispy_val; - unsigned long denominator; + EMACS_UINT denominator; if (EQ (limit, Qt)) seed_random (getpid () + time (NULL)); @@ -88,7 +88,7 @@ Other values of LIMIT are ignored. */) it's possible to get a quotient larger than n; discarding these values eliminates the bias that would otherwise appear when using a large n. */ - denominator = ((unsigned long)1 << VALBITS) / XFASTINT (limit); + denominator = ((EMACS_UINT) 1 << VALBITS) / XFASTINT (limit); do val = get_random () / denominator; while (val >= XFASTINT (limit)); -- 2.39.2