This reverts commit3ec807e99a
. Our nightly build test cases rely on the PRN sequence generated by GNU libc's random(). We used to have such a PRNG in our tree (derived from an old version of GNU libc's), for use under Windows. Thus we got the same PRN sequence on both our nightly test systems. Commit3ec807e9
switched to -liberty under Windows and removed our random(). Now we got a different sequence there, breaking the test cases. Test cases still don't work on non-Windows systems where random() doesn't match GNU libc's. We should switch to a PRNG that produces the same sequence everywhere. Conflicts: src/lib/w32/w32misc.h
44 lines
1.5 KiB
C
44 lines
1.5 KiB
C
#include <io.h>
|
|
|
|
typedef int int32_t;
|
|
#define NULL ((void *)0)
|
|
struct random_data
|
|
{
|
|
int32_t *fptr; /* Front pointer. */
|
|
int32_t *rptr; /* Rear pointer. */
|
|
int32_t *state; /* Array of state values. */
|
|
int rand_type; /* Type of random number generator. */
|
|
int rand_deg; /* Degree of random number generator. */
|
|
int rand_sep; /* Distance between front and rear. */
|
|
int32_t *end_ptr; /* Pointer behind state table. */
|
|
};
|
|
|
|
/*
|
|
* Not required as the empire scheduler ensure only
|
|
* one thread is active at a time
|
|
*/
|
|
#define __libc_lock_lock(lock)
|
|
#define __libc_lock_unlock(lock)
|
|
#define __libc_lock_define_initialized(static1, lock)
|
|
|
|
#ifdef _MSC_VER
|
|
#define __set_errno(val) _set_errno((val))
|
|
#else
|
|
#define __set_errno(val) (errno = (val))
|
|
#endif
|
|
|
|
#define weak_alias(arg1, arg2)
|
|
#define srandom_r(seed, buf) __srandom_r((seed), (buf))
|
|
#define random_r(buf, result) __random_r((buf), (result))
|
|
#define initstate_r(seed, state, size, buf) \
|
|
__initstate_r((seed), (state), (size), (buf))
|
|
#define setstate_r(state, buf) __setstate_r((state), (buf))
|
|
|
|
extern int __random_r (struct random_data *__restrict __buf,
|
|
int32_t *__restrict __result);
|
|
extern int __srandom_r (unsigned int __seed, struct random_data *__buf);
|
|
extern int __initstate_r (unsigned int __seed, char *__restrict __statebuf,
|
|
size_t __statelen,
|
|
struct random_data *__restrict __buf);
|
|
extern int __setstate_r (char *__restrict __statebuf,
|
|
struct random_data *__restrict __buf);
|