diff options
| author | Karl Heuer | 1994-09-19 00:15:08 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-09-19 00:15:08 +0000 |
| commit | 9309fdb17ffc0b686b5094826d757f5bf4ab93c4 (patch) | |
| tree | a6f4772195a7260b501deea2715b3c359bf8d0fd /src | |
| parent | 1bb5916bcddf016c937703af87ed180f8a70c765 (diff) | |
| download | emacs-9309fdb17ffc0b686b5094826d757f5bf4ab93c4.tar.gz emacs-9309fdb17ffc0b686b5094826d757f5bf4ab93c4.zip | |
(Frandom): Fix Lisp_Object vs. int problems.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -32,6 +32,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 32 | #include "keyboard.h" | 32 | #include "keyboard.h" |
| 33 | #include "intervals.h" | 33 | #include "intervals.h" |
| 34 | 34 | ||
| 35 | extern Lisp_Object Flookup_key (); | ||
| 36 | |||
| 35 | Lisp_Object Qstring_lessp, Qprovide, Qrequire; | 37 | Lisp_Object Qstring_lessp, Qprovide, Qrequire; |
| 36 | Lisp_Object Qyes_or_no_p_history; | 38 | Lisp_Object Qyes_or_no_p_history; |
| 37 | 39 | ||
| @@ -64,9 +66,9 @@ With argument t, set the random number seed from the current time and pid.") | |||
| 64 | srandom (getpid () + time (0)); | 66 | srandom (getpid () + time (0)); |
| 65 | if (XTYPE (limit) == Lisp_Int && XINT (limit) > 0) | 67 | if (XTYPE (limit) == Lisp_Int && XINT (limit) > 0) |
| 66 | { | 68 | { |
| 67 | if (XINT (limit) >= 0x40000000) | 69 | if (XFASTINT (limit) >= 0x40000000) |
| 68 | /* This case may occur on 64-bit machines. */ | 70 | /* This case may occur on 64-bit machines. */ |
| 69 | val = random () % XINT (limit); | 71 | val = random () % XFASTINT (limit); |
| 70 | else | 72 | else |
| 71 | { | 73 | { |
| 72 | /* Try to take our random number from the higher bits of VAL, | 74 | /* Try to take our random number from the higher bits of VAL, |
| @@ -79,7 +81,7 @@ With argument t, set the random number seed from the current time and pid.") | |||
| 79 | denominator = (unsigned long)0x40000000 / XFASTINT (limit); | 81 | denominator = (unsigned long)0x40000000 / XFASTINT (limit); |
| 80 | do | 82 | do |
| 81 | val = (random () & 0x3fffffff) / denominator; | 83 | val = (random () & 0x3fffffff) / denominator; |
| 82 | while (val >= limit); | 84 | while (val >= XFASTINT (limit)); |
| 83 | } | 85 | } |
| 84 | } | 86 | } |
| 85 | else | 87 | else |