Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
92394119
Commit
92394119
authored
Apr 27, 2011
by
Paul Eggert
Browse files
* fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.
parent
8fff8daa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
src/ChangeLog
src/ChangeLog
+4
-0
src/fns.c
src/fns.c
+2
-2
No files found.
src/ChangeLog
View file @
92394119
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.
...
...
src/fns.c
View file @
92394119
...
@@ -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
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment