From df906d2e75d6822c88999b8cc537166371f2da6e Mon Sep 17 00:00:00 2001 From: "Paul R. Eggert" Date: Fri, 23 Jul 2010 15:07:27 -0700 Subject: randread: run 2x faster on 64-bit hosts, don't assume no padding bits * gl/lib/rand-isaac.c: Remove the I/O; this belongs elsewhere. Add support for ISAAC64. Port to hosts with padding bits. Add self to author list. Include , for CHAR_BIT. Don't include string.h, sys/time.h, unistd.h. (min, just): New functions. (IF32): New macros. (ind, ISAAC_STEP, isaac_refill, mix, isaac_init, isaac_seed): Add support for ISAAC64. Port to hosts with padding bits. (ind): Now an inline function rather than a macro; no need for it to be a macro with modern compilers. (ISAAC_STEP): Renamed from isaac_step, since it's not function-like. Don't bother to pass args that are always the same. All uses changed. (ISAAC_STEP, ISAAC_SEED): Move to inside the only function body that can use it. (ISAAC_MIX): Renamed from isaac_mix, since it's now a macro and is no longer function-like. Don't bother saving and restoring state; no longer needed now that we're not a function. All uses changed. (isaac_seed_start, isaac_seed_data, isaac_seed_finish): Remove. (isaac_seed): Take just the one arg; the caller now sets s->m. * gl/lib/rand-isaac.h: Use _GL_RAND_ISAAC_H to protect, instead of RAND_ISAAC_H. Try out " #" rather than "# " for indenting. (ISAAC_BITS_LOG, ISAAC_BITS): New macros. (ISAAC_WORDS_LOG): Renamed from ISAAC_LOG. (isaac_word): New type. All uses of uint32_t changed to isaac_word, to support ISAAC64. (struct isaac_state): Rename member MM to M, and make it public. (isaac_seed, isaac_refill): Adjust to new API. * gl/lib/randread.c: Include sys/time.h. (get_nonce): New function, containing the nonce stuff that used to be in rand-isaac.c but better belongs here. (randread_new): Use it. * gl/modules/randread (Depends-on): Add inline. * gl/modules/randread-tests: New file. * gl/tests/test-rand-isaac.c: New file. --- gl/modules/randread | 1 + gl/modules/randread-tests | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 gl/modules/randread-tests (limited to 'gl/modules') diff --git a/gl/modules/randread b/gl/modules/randread index efc795826..1c4a9051c 100644 --- a/gl/modules/randread +++ b/gl/modules/randread @@ -10,6 +10,7 @@ lib/randread.h Depends-on: error exitfail +inline fopen-safer gettimeofday quotearg diff --git a/gl/modules/randread-tests b/gl/modules/randread-tests new file mode 100644 index 000000000..b608ac67a --- /dev/null +++ b/gl/modules/randread-tests @@ -0,0 +1,10 @@ +Files: +tests/test-rand-isaac.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-rand-isaac +check_PROGRAMS += test-rand-isaac -- cgit v1.2.3-54-g00ecf