* fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Apr 2011 00:43:18 +0000 (17:43 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Apr 2011 00:43:18 +0000 (17:43 -0700)
src/ChangeLog
src/fns.c

index 567c125..a43e61f 100644 (file)
@@ -1,3 +1,7 @@
+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>
 
        * doprnt.c (doprnt): Support "ll" length modifier, for long long.
index a128b92..47ded45 100644 (file)
--- 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));