mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-09 14:07:34 +02:00
Checking for __GNU_LIBRARY__ to use random_r.
This commit is contained in:
parent
cc4ec96001
commit
7d8098b549
1 changed files with 5 additions and 5 deletions
|
@ -19,14 +19,14 @@
|
||||||
SEXP_RANDOM_STATE_SIZE, \
|
SEXP_RANDOM_STATE_SIZE, \
|
||||||
sexp_random_data(x))
|
sexp_random_data(x))
|
||||||
|
|
||||||
#if SEXP_BSD || defined(__CYGWIN__)
|
#ifdef __GNU_LIBRARY__
|
||||||
typedef unsigned int sexp_random_t;
|
|
||||||
#define sexp_call_random(rs, dst) ((dst) = rand_r(sexp_random_data(rs)))
|
|
||||||
#define sexp_seed_random(n, rs) *sexp_random_data(rs) = (n)
|
|
||||||
#else
|
|
||||||
typedef struct random_data sexp_random_t;
|
typedef struct random_data sexp_random_t;
|
||||||
#define sexp_call_random(rs, dst) random_r(sexp_random_data(rs), &dst)
|
#define sexp_call_random(rs, dst) random_r(sexp_random_data(rs), &dst)
|
||||||
#define sexp_seed_random(n, rs) srandom_r(n, sexp_random_data(rs))
|
#define sexp_seed_random(n, rs) srandom_r(n, sexp_random_data(rs))
|
||||||
|
#else
|
||||||
|
typedef unsigned int sexp_random_t;
|
||||||
|
#define sexp_call_random(rs, dst) ((dst) = rand_r(sexp_random_data(rs)))
|
||||||
|
#define sexp_seed_random(n, rs) *sexp_random_data(rs) = (n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define sexp_random_state(x) (sexp_slot_ref((x), 0))
|
#define sexp_random_state(x) (sexp_slot_ref((x), 0))
|
||||||
|
|
Loading…
Add table
Reference in a new issue