aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-27 17:43:18 -0700
committerPaul Eggert2011-04-27 17:43:18 -0700
commit92394119721e6a581c344fa5c0e47faa9283ddef (patch)
treec38a01b70195f4f5985c70d1c2e773d565e41663 /src
parent8fff8daa8993c8d91e5cfbe1eb84ebf3f3dfca4c (diff)
downloademacs-92394119721e6a581c344fa5c0e47faa9283ddef.tar.gz
emacs-92394119721e6a581c344fa5c0e47faa9283ddef.zip
* fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/fns.c4
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 @@
12011-04-28 Paul Eggert <eggert@cs.ucla.edu>
2
3 * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.
4
12011-04-27 Paul Eggert <eggert@cs.ucla.edu> 52011-04-27 Paul Eggert <eggert@cs.ucla.edu>
2 6
3 * doprnt.c (doprnt): Support "ll" length modifier, for long long. 7 * 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. */)
75{ 75{
76 EMACS_INT val; 76 EMACS_INT val;
77 Lisp_Object lispy_val; 77 Lisp_Object lispy_val;
78 unsigned long denominator; 78 EMACS_UINT denominator;
79 79
80 if (EQ (limit, Qt)) 80 if (EQ (limit, Qt))
81 seed_random (getpid () + time (NULL)); 81 seed_random (getpid () + time (NULL));
@@ -88,7 +88,7 @@ Other values of LIMIT are ignored. */)
88 it's possible to get a quotient larger than n; discarding 88 it's possible to get a quotient larger than n; discarding
89 these values eliminates the bias that would otherwise appear 89 these values eliminates the bias that would otherwise appear
90 when using a large n. */ 90 when using a large n. */
91 denominator = ((unsigned long)1 << VALBITS) / XFASTINT (limit); 91 denominator = ((EMACS_UINT) 1 << VALBITS) / XFASTINT (limit);
92 do 92 do
93 val = get_random () / denominator; 93 val = get_random () / denominator;
94 while (val >= XFASTINT (limit)); 94 while (val >= XFASTINT (limit));