HCoop
/
bpt
/
guile.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f7677ff
)
* random.c: Removed alloca includes.
author
Mikael Djurfeldt
<djurfeldt@nada.kth.se>
Mon, 11 Jan 1999 07:13:18 +0000
(07:13 +0000)
committer
Mikael Djurfeldt
<djurfeldt@nada.kth.se>
Mon, 11 Jan 1999 07:13:18 +0000
(07:13 +0000)
libguile/random.c
patch
|
blob
|
blame
|
history
diff --git
a/libguile/random.c
b/libguile/random.c
index
f77e693
..
c9665d6
100644
(file)
--- a/
libguile/random.c
+++ b/
libguile/random.c
@@
-40,26
+40,6
@@
/* Author: Mikael Djurfeldt <djurfeldt@nada.kth.se> */
/* Author: Mikael Djurfeldt <djurfeldt@nada.kth.se> */
-/* We need this to get the definitions for HAVE_ALLOCA_H, etc. */
-#include "scmconfig.h"
-
-/* AIX requires this to be the first thing in the file. The #pragma
- directive is indented so pre-ANSI compilers will ignore it, rather
- than choke on it. */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-#endif
-
#include "_scm.h"
#include <math.h>
#include "_scm.h"
#include <math.h>
@@
-196,9
+176,9
@@
scm_i_copy_rstate (scm_i_rstate *state)
inline double
scm_i_uniform01 (scm_rstate *state)
{
inline double
scm_i_uniform01 (scm_rstate *state)
{
- double x = (double) scm_the_rng.random_bits (state) / (double) 0x
FFFFFFFF
UL;
+ double x = (double) scm_the_rng.random_bits (state) / (double) 0x
ffffffff
UL;
return ((x + (double) scm_the_rng.random_bits (state))
return ((x + (double) scm_the_rng.random_bits (state))
- / (double) 0x
FFFFFFFF
UL);
+ / (double) 0x
ffffffff
UL);
}
double
}
double
@@
-212,13
+192,13
@@
scm_i_normal01 (scm_rstate *state)
else
{
double r, a, n;
else
{
double r, a, n;
- state->reserved0 = 1;
r = sqrt (-2.0 * log (scm_i_uniform01 (state)));
a = 2.0 * M_PI * scm_i_uniform01 (state);
n = r * sin (a);
state->reserved1 = r * cos (a);
r = sqrt (-2.0 * log (scm_i_uniform01 (state)));
a = 2.0 * M_PI * scm_i_uniform01 (state);
n = r * sin (a);
state->reserved1 = r * cos (a);
+ state->reserved0 = 1;
return n;
}
return n;
}
@@
-239,10
+219,10
@@
scm_i_random (unsigned long m, scm_rstate *state)
mask = (m < 0x100
? scm_masktab[m]
: (m < 0x10000
mask = (m < 0x100
? scm_masktab[m]
: (m < 0x10000
- ? scm_masktab[m >> 8] << 8 | 0x
FF
+ ? scm_masktab[m >> 8] << 8 | 0x
ff
: (m < 0x1000000
: (m < 0x1000000
- ? scm_masktab[m >> 16] << 16 | 0x
FFFF
- : scm_masktab[m >> 24] << 24 | 0x
FFFFFF
)));
+ ? scm_masktab[m >> 16] << 16 | 0x
ffff
+ : scm_masktab[m >> 24] << 24 | 0x
ffffff
)));
while ((r = scm_the_rng.random_bits (state) & mask) >= m);
return r;
}
while ((r = scm_the_rng.random_bits (state) & mask) >= m);
return r;
}
@@
-261,7
+241,7
@@
scm_i_random_bignum (SCM m, scm_rstate *state)
{
/* fix most significant 16 bits */
unsigned short s = SCM_BDIGITS (m)[nd - 1];
{
/* fix most significant 16 bits */
unsigned short s = SCM_BDIGITS (m)[nd - 1];
- mask = s < 0x100 ? scm_masktab[s] : scm_masktab[s >> 8] << 8 | 0x
FF
;
+ mask = s < 0x100 ? scm_masktab[s] : scm_masktab[s >> 8] << 8 | 0x
ff
;
}
else
#endif
}
else
#endif
@@
-271,10
+251,10
@@
scm_i_random_bignum (SCM m, scm_rstate *state)
mask = (w < 0x10000
? (w < 0x100
? scm_masktab[w]
mask = (w < 0x10000
? (w < 0x100
? scm_masktab[w]
- : scm_masktab[w >> 8] << 8 | 0x
FF
)
+ : scm_masktab[w >> 8] << 8 | 0x
ff
)
: (w < 0x1000000
: (w < 0x1000000
- ? scm_masktab[w >> 16] << 16 | 0x
FFFF
- : scm_masktab[w >> 24] << 24 | 0x
FFFFFF
));
+ ? scm_masktab[w >> 16] << 16 | 0x
ffff
+ : scm_masktab[w >> 24] << 24 | 0x
ffffff
));
}
b = scm_mkbig (nd, 0);
bits = (LONG32 *) SCM_BDIGITS (b);
}
b = scm_mkbig (nd, 0);
bits = (LONG32 *) SCM_BDIGITS (b);