Commit 92394119 authored by Paul Eggert's avatar Paul Eggert
Browse files

* fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.

parent 8fff8daa
2011-04-28 Paul Eggert <eggert@cs.ucla.edu>
* fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.
2011-04-27 Paul Eggert <eggert@cs.ucla.edu> 2011-04-27 Paul Eggert <eggert@cs.ucla.edu>
* doprnt.c (doprnt): Support "ll" length modifier, for long long. * doprnt.c (doprnt): Support "ll" length modifier, for long long.
......
...@@ -75,7 +75,7 @@ Other values of LIMIT are ignored. */) ...@@ -75,7 +75,7 @@ Other values of LIMIT are ignored. */)
{ {
EMACS_INT val; EMACS_INT val;
Lisp_Object lispy_val; Lisp_Object lispy_val;
unsigned long denominator; EMACS_UINT denominator;
if (EQ (limit, Qt)) if (EQ (limit, Qt))
seed_random (getpid () + time (NULL)); seed_random (getpid () + time (NULL));
...@@ -88,7 +88,7 @@ Other values of LIMIT are ignored. */) ...@@ -88,7 +88,7 @@ Other values of LIMIT are ignored. */)
it's possible to get a quotient larger than n; discarding it's possible to get a quotient larger than n; discarding
these values eliminates the bias that would otherwise appear these values eliminates the bias that would otherwise appear
when using a large n. */ when using a large n. */
denominator = ((unsigned long)1 << VALBITS) / XFASTINT (limit); denominator = ((EMACS_UINT) 1 << VALBITS) / XFASTINT (limit);
do do
val = get_random () / denominator; val = get_random () / denominator;
while (val >= XFASTINT (limit)); while (val >= XFASTINT (limit));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment