changeset 23:bf9169ad4222

add SMID-oriented fast mersenne twister
author Robert McIntyre <rlm@mit.edu>
date Sun, 04 Mar 2012 17:38:32 -0600
parents 8870086b716c
children 59790d015f25
files src/SFMT/CHANGE-LOG.txt src/SFMT/LICENSE.txt src/SFMT/README.txt src/SFMT/SFMT-alti.h src/SFMT/SFMT-params.h src/SFMT/SFMT-params11213.h src/SFMT/SFMT-params1279.h src/SFMT/SFMT-params132049.h src/SFMT/SFMT-params19937.h src/SFMT/SFMT-params216091.h src/SFMT/SFMT-params2281.h src/SFMT/SFMT-params4253.h src/SFMT/SFMT-params44497.h src/SFMT/SFMT-params607.h src/SFMT/SFMT-params86243.h src/SFMT/SFMT-sse2.h src/SFMT/SFMT.c src/SFMT/SFMT.h src/common/lua-engine.cpp
diffstat 19 files changed, 1729 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/SFMT/CHANGE-LOG.txt	Sun Mar 04 17:38:32 2012 -0600
     1.3 @@ -0,0 +1,55 @@
     1.4 +ver 1.3.3
     1.5 +-------
     1.6 +change condition compile of do_recursion in SFMT.c
     1.7 +
     1.8 +ver 1.3.2
     1.9 +-------
    1.10 +bug fix to_res53_mix and genrand_res53_mix.
    1.11 +
    1.12 +ver 1.3.1
    1.13 +-------
    1.14 +gcc compile option changed form -O9 to -O3.
    1.15 +add functions genrand_res53_mix and to_res53_mix.
    1.16 +bug fix about definition of ALWAYS_INLINE.
    1.17 +add new definition PRE_ALWAYS for MSC.
    1.18 +
    1.19 +ver 1.3
    1.20 +-------
    1.21 +bug fixed: -DONLY64 without -DBIG_ENIAN64 had been generating
    1.22 +wrong sequence.
    1.23 +bug fixed: There is no documentation about BIG_ENDIAN64.
    1.24 +add automatic endian check by __BIG_ENDIAN__ predefined macro.
    1.25 +bug fixed: change == in check.sh to =
    1.26 +add SFMT-params216091.h
    1.27 +add AltiVec parameter format for systems which are not osx.
    1.28 +change Makefile for systems which are not osx and support AltiVec.
    1.29 +change sample2 of howto-compile for Free BSD.
    1.30 +change source files for BORLANDC and Visual Studio.
    1.31 +change period certification code more smart.
    1.32 +add params directory.
    1.33 +
    1.34 +ver 1.2.1
    1.35 +-------
    1.36 +Fix typo in SFMT-alti.c SFMT-sse2.c
    1.37 +marge SFMT-alti.c and SFMT-alti.h into SFMT-alti.h
    1.38 +marge SFMT-sse2.c and SFMT-sse2.h into SFMT-sse2.h
    1.39 +This version is not released.
    1.40 +
    1.41 +ver 1.2
    1.42 +-------
    1.43 +Support many periods: 2^{607}, 2^{1279}, 2^{2281}, 2^{4253}, 2^{11213},
    1.44 +2^{19937}, 2^{44497}, 2^{86243}, 2^{132049}
    1.45 +Fix typo in LICENSE.txt.
    1.46 +Add cast to vec_perm for SFMT-alti.c, SFMT-alti64.c.
    1.47 +combine source codes.
    1.48 +
    1.49 +ver 1.1
    1.50 +-------
    1.51 +The period certification method is changed from constant to function.
    1.52 +The convert functions from 32-bit and 64-bit integer to double are added.
    1.53 +The documentation is changed.
    1.54 +Sample programs are added.
    1.55 +
    1.56 +ver 1.0
    1.57 +-------
    1.58 +The first version.
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/SFMT/LICENSE.txt	Sun Mar 04 17:38:32 2012 -0600
     2.3 @@ -0,0 +1,29 @@
     2.4 +Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
     2.5 +University. All rights reserved.
     2.6 +
     2.7 +Redistribution and use in source and binary forms, with or without
     2.8 +modification, are permitted provided that the following conditions are
     2.9 +met:
    2.10 +
    2.11 +    * Redistributions of source code must retain the above copyright
    2.12 +      notice, this list of conditions and the following disclaimer.
    2.13 +    * Redistributions in binary form must reproduce the above
    2.14 +      copyright notice, this list of conditions and the following
    2.15 +      disclaimer in the documentation and/or other materials provided
    2.16 +      with the distribution.
    2.17 +    * Neither the name of the Hiroshima University nor the names of
    2.18 +      its contributors may be used to endorse or promote products
    2.19 +      derived from this software without specific prior written
    2.20 +      permission.
    2.21 +
    2.22 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    2.23 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    2.24 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    2.25 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    2.26 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    2.27 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    2.28 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    2.29 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    2.30 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2.31 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2.32 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/SFMT/README.txt	Sun Mar 04 17:38:32 2012 -0600
     3.3 @@ -0,0 +1,22 @@
     3.4 + =================================================================
     3.5 + SFMT ver. 1.3.3
     3.6 + SIMD oriented Fast Mersenne Twister(SFMT)
     3.7 +
     3.8 + Mutsuo Saito (Hiroshima University) and
     3.9 + Makoto Matsumoto (Hiroshima University)
    3.10 +
    3.11 + Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
    3.12 + University. All rights reserved.
    3.13 +
    3.14 + The (modified) BSD License is applied to this software, see LICENSE.txt
    3.15 + =================================================================
    3.16 +
    3.17 + To see documents, see html/index.html.
    3.18 +
    3.19 + To make test program, see html/howto-compile.html
    3.20 +
    3.21 + If you want to redistribute and/or change source files, see LICENSE.txt.
    3.22 +
    3.23 + When you change these files and redistribute them, PLEASE write your
    3.24 + e-mail address in redistribution and write to contact YOU first if
    3.25 + users of your changed source encounter troubles.
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/SFMT/SFMT-alti.h	Sun Mar 04 17:38:32 2012 -0600
     4.3 @@ -0,0 +1,156 @@
     4.4 +/** 
     4.5 + * @file SFMT-alti.h 
     4.6 + *
     4.7 + * @brief SIMD oriented Fast Mersenne Twister(SFMT)
     4.8 + * pseudorandom number generator
     4.9 + *
    4.10 + * @author Mutsuo Saito (Hiroshima University)
    4.11 + * @author Makoto Matsumoto (Hiroshima University)
    4.12 + *
    4.13 + * Copyright (C) 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
    4.14 + * University. All rights reserved.
    4.15 + *
    4.16 + * The new BSD License is applied to this software.
    4.17 + * see LICENSE.txt
    4.18 + */
    4.19 +
    4.20 +#ifndef SFMT_ALTI_H
    4.21 +#define SFMT_ALTI_H
    4.22 +
    4.23 +inline static vector unsigned int vec_recursion(vector unsigned int a,
    4.24 +						vector unsigned int b,
    4.25 +						vector unsigned int c,
    4.26 +						vector unsigned int d)
    4.27 +    ALWAYSINLINE;
    4.28 +
    4.29 +/**
    4.30 + * This function represents the recursion formula in AltiVec and BIG ENDIAN.
    4.31 + * @param a a 128-bit part of the interal state array
    4.32 + * @param b a 128-bit part of the interal state array
    4.33 + * @param c a 128-bit part of the interal state array
    4.34 + * @param d a 128-bit part of the interal state array
    4.35 + * @return output
    4.36 + */
    4.37 +inline static vector unsigned int vec_recursion(vector unsigned int a,
    4.38 +						vector unsigned int b,
    4.39 +						vector unsigned int c,
    4.40 +						vector unsigned int d) {
    4.41 +
    4.42 +    const vector unsigned int sl1 = ALTI_SL1;
    4.43 +    const vector unsigned int sr1 = ALTI_SR1;
    4.44 +#ifdef ONLY64
    4.45 +    const vector unsigned int mask = ALTI_MSK64;
    4.46 +    const vector unsigned char perm_sl = ALTI_SL2_PERM64;
    4.47 +    const vector unsigned char perm_sr = ALTI_SR2_PERM64;
    4.48 +#else
    4.49 +    const vector unsigned int mask = ALTI_MSK;
    4.50 +    const vector unsigned char perm_sl = ALTI_SL2_PERM;
    4.51 +    const vector unsigned char perm_sr = ALTI_SR2_PERM;
    4.52 +#endif
    4.53 +    vector unsigned int v, w, x, y, z;
    4.54 +    x = vec_perm(a, (vector unsigned int)perm_sl, perm_sl);
    4.55 +    v = a;
    4.56 +    y = vec_sr(b, sr1);
    4.57 +    z = vec_perm(c, (vector unsigned int)perm_sr, perm_sr);
    4.58 +    w = vec_sl(d, sl1);
    4.59 +    z = vec_xor(z, w);
    4.60 +    y = vec_and(y, mask);
    4.61 +    v = vec_xor(v, x);
    4.62 +    z = vec_xor(z, y);
    4.63 +    z = vec_xor(z, v);
    4.64 +    return z;
    4.65 +}
    4.66 +
    4.67 +/**
    4.68 + * This function fills the internal state array with pseudorandom
    4.69 + * integers.
    4.70 + */
    4.71 +inline static void gen_rand_all(void) {
    4.72 +    int i;
    4.73 +    vector unsigned int r, r1, r2;
    4.74 +
    4.75 +    r1 = sfmt[N - 2].s;
    4.76 +    r2 = sfmt[N - 1].s;
    4.77 +    for (i = 0; i < N - POS1; i++) {
    4.78 +	r = vec_recursion(sfmt[i].s, sfmt[i + POS1].s, r1, r2);
    4.79 +	sfmt[i].s = r;
    4.80 +	r1 = r2;
    4.81 +	r2 = r;
    4.82 +    }
    4.83 +    for (; i < N; i++) {
    4.84 +	r = vec_recursion(sfmt[i].s, sfmt[i + POS1 - N].s, r1, r2);
    4.85 +	sfmt[i].s = r;
    4.86 +	r1 = r2;
    4.87 +	r2 = r;
    4.88 +    }
    4.89 +}
    4.90 +
    4.91 +/**
    4.92 + * This function fills the user-specified array with pseudorandom
    4.93 + * integers.
    4.94 + *
    4.95 + * @param array an 128-bit array to be filled by pseudorandom numbers.  
    4.96 + * @param size number of 128-bit pesudorandom numbers to be generated.
    4.97 + */
    4.98 +inline static void gen_rand_array(w128_t *array, int size) {
    4.99 +    int i, j;
   4.100 +    vector unsigned int r, r1, r2;
   4.101 +
   4.102 +    r1 = sfmt[N - 2].s;
   4.103 +    r2 = sfmt[N - 1].s;
   4.104 +    for (i = 0; i < N - POS1; i++) {
   4.105 +	r = vec_recursion(sfmt[i].s, sfmt[i + POS1].s, r1, r2);
   4.106 +	array[i].s = r;
   4.107 +	r1 = r2;
   4.108 +	r2 = r;
   4.109 +    }
   4.110 +    for (; i < N; i++) {
   4.111 +	r = vec_recursion(sfmt[i].s, array[i + POS1 - N].s, r1, r2);
   4.112 +	array[i].s = r;
   4.113 +	r1 = r2;
   4.114 +	r2 = r;
   4.115 +    }
   4.116 +    /* main loop */
   4.117 +    for (; i < size - N; i++) {
   4.118 +	r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2);
   4.119 +	array[i].s = r;
   4.120 +	r1 = r2;
   4.121 +	r2 = r;
   4.122 +    }
   4.123 +    for (j = 0; j < 2 * N - size; j++) {
   4.124 +	sfmt[j].s = array[j + size - N].s;
   4.125 +    }
   4.126 +    for (; i < size; i++) {
   4.127 +	r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2);
   4.128 +	array[i].s = r;
   4.129 +	sfmt[j++].s = r;
   4.130 +	r1 = r2;
   4.131 +	r2 = r;
   4.132 +    }
   4.133 +}
   4.134 +
   4.135 +#ifndef ONLY64
   4.136 +#if defined(__APPLE__)
   4.137 +#define ALTI_SWAP (vector unsigned char) \
   4.138 +	(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11)
   4.139 +#else
   4.140 +#define ALTI_SWAP {4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11}
   4.141 +#endif
   4.142 +/**
   4.143 + * This function swaps high and low 32-bit of 64-bit integers in user
   4.144 + * specified array.
   4.145 + *
   4.146 + * @param array an 128-bit array to be swaped.
   4.147 + * @param size size of 128-bit array.
   4.148 + */
   4.149 +inline static void swap(w128_t *array, int size) {
   4.150 +    int i;
   4.151 +    const vector unsigned char perm = ALTI_SWAP;
   4.152 +
   4.153 +    for (i = 0; i < size; i++) {
   4.154 +	array[i].s = vec_perm(array[i].s, (vector unsigned int)perm, perm);
   4.155 +    }
   4.156 +}
   4.157 +#endif
   4.158 +
   4.159 +#endif
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/SFMT/SFMT-params.h	Sun Mar 04 17:38:32 2012 -0600
     5.3 @@ -0,0 +1,97 @@
     5.4 +#ifndef SFMT_PARAMS_H
     5.5 +#define SFMT_PARAMS_H
     5.6 +
     5.7 +#if !defined(MEXP)
     5.8 +#ifdef __GNUC__
     5.9 +  #warning "MEXP is not defined. I assume MEXP is 19937."
    5.10 +#endif
    5.11 +  #define MEXP 19937
    5.12 +#endif
    5.13 +/*-----------------
    5.14 +  BASIC DEFINITIONS
    5.15 +  -----------------*/
    5.16 +/** Mersenne Exponent. The period of the sequence 
    5.17 + *  is a multiple of 2^MEXP-1.
    5.18 + * #define MEXP 19937 */
    5.19 +/** SFMT generator has an internal state array of 128-bit integers,
    5.20 + * and N is its size. */
    5.21 +#define N (MEXP / 128 + 1)
    5.22 +/** N32 is the size of internal state array when regarded as an array
    5.23 + * of 32-bit integers.*/
    5.24 +#define N32 (N * 4)
    5.25 +/** N64 is the size of internal state array when regarded as an array
    5.26 + * of 64-bit integers.*/
    5.27 +#define N64 (N * 2)
    5.28 +
    5.29 +/*----------------------
    5.30 +  the parameters of SFMT
    5.31 +  following definitions are in paramsXXXX.h file.
    5.32 +  ----------------------*/
    5.33 +/** the pick up position of the array.
    5.34 +#define POS1 122 
    5.35 +*/
    5.36 +
    5.37 +/** the parameter of shift left as four 32-bit registers.
    5.38 +#define SL1 18
    5.39 + */
    5.40 +
    5.41 +/** the parameter of shift left as one 128-bit register. 
    5.42 + * The 128-bit integer is shifted by (SL2 * 8) bits. 
    5.43 +#define SL2 1 
    5.44 +*/
    5.45 +
    5.46 +/** the parameter of shift right as four 32-bit registers.
    5.47 +#define SR1 11
    5.48 +*/
    5.49 +
    5.50 +/** the parameter of shift right as one 128-bit register. 
    5.51 + * The 128-bit integer is shifted by (SL2 * 8) bits. 
    5.52 +#define SR2 1 
    5.53 +*/
    5.54 +
    5.55 +/** A bitmask, used in the recursion.  These parameters are introduced
    5.56 + * to break symmetry of SIMD.
    5.57 +#define MSK1 0xdfffffefU
    5.58 +#define MSK2 0xddfecb7fU
    5.59 +#define MSK3 0xbffaffffU
    5.60 +#define MSK4 0xbffffff6U 
    5.61 +*/
    5.62 +
    5.63 +/** These definitions are part of a 128-bit period certification vector.
    5.64 +#define PARITY1	0x00000001U
    5.65 +#define PARITY2	0x00000000U
    5.66 +#define PARITY3	0x00000000U
    5.67 +#define PARITY4	0xc98e126aU
    5.68 +*/
    5.69 +
    5.70 +#if MEXP == 607
    5.71 +  #include "SFMT-params607.h"
    5.72 +#elif MEXP == 1279
    5.73 +  #include "SFMT-params1279.h"
    5.74 +#elif MEXP == 2281
    5.75 +  #include "SFMT-params2281.h"
    5.76 +#elif MEXP == 4253
    5.77 +  #include "SFMT-params4253.h"
    5.78 +#elif MEXP == 11213
    5.79 +  #include "SFMT-params11213.h"
    5.80 +#elif MEXP == 19937
    5.81 +  #include "SFMT-params19937.h"
    5.82 +#elif MEXP == 44497
    5.83 +  #include "SFMT-params44497.h"
    5.84 +#elif MEXP == 86243
    5.85 +  #include "SFMT-params86243.h"
    5.86 +#elif MEXP == 132049
    5.87 +  #include "SFMT-params132049.h"
    5.88 +#elif MEXP == 216091
    5.89 +  #include "SFMT-params216091.h"
    5.90 +#else
    5.91 +#ifdef __GNUC__
    5.92 +  #error "MEXP is not valid."
    5.93 +  #undef MEXP
    5.94 +#else
    5.95 +  #undef MEXP
    5.96 +#endif
    5.97 +
    5.98 +#endif
    5.99 +
   5.100 +#endif /* SFMT_PARAMS_H */
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/SFMT/SFMT-params11213.h	Sun Mar 04 17:38:32 2012 -0600
     6.3 @@ -0,0 +1,46 @@
     6.4 +#ifndef SFMT_PARAMS11213_H
     6.5 +#define SFMT_PARAMS11213_H
     6.6 +
     6.7 +#define POS1	68
     6.8 +#define SL1	14
     6.9 +#define SL2	3
    6.10 +#define SR1	7
    6.11 +#define SR2	3
    6.12 +#define MSK1	0xeffff7fbU
    6.13 +#define MSK2	0xffffffefU
    6.14 +#define MSK3	0xdfdfbfffU
    6.15 +#define MSK4	0x7fffdbfdU
    6.16 +#define PARITY1	0x00000001U
    6.17 +#define PARITY2	0x00000000U
    6.18 +#define PARITY3	0xe8148000U
    6.19 +#define PARITY4	0xd0c7afa3U
    6.20 +
    6.21 +
    6.22 +/* PARAMETERS FOR ALTIVEC */
    6.23 +#if defined(__APPLE__)	/* For OSX */
    6.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
    6.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
    6.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
    6.27 +    #define ALTI_MSK64 \
    6.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
    6.29 +    #define ALTI_SL2_PERM \
    6.30 +	(vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
    6.31 +    #define ALTI_SL2_PERM64 \
    6.32 +	(vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
    6.33 +    #define ALTI_SR2_PERM \
    6.34 +	(vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12)
    6.35 +    #define ALTI_SR2_PERM64 \
    6.36 +	(vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12)
    6.37 +#else	/* For OTHER OSs(Linux?) */
    6.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
    6.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
    6.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
    6.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
    6.42 +    #define ALTI_SL2_PERM	{3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
    6.43 +    #define ALTI_SL2_PERM64	{3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
    6.44 +    #define ALTI_SR2_PERM	{5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12}
    6.45 +    #define ALTI_SR2_PERM64	{13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12}
    6.46 +#endif	/* For OSX */
    6.47 +#define IDSTR	"SFMT-11213:68-14-3-7-3:effff7fb-ffffffef-dfdfbfff-7fffdbfd"
    6.48 +
    6.49 +#endif /* SFMT_PARAMS11213_H */
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/SFMT/SFMT-params1279.h	Sun Mar 04 17:38:32 2012 -0600
     7.3 @@ -0,0 +1,46 @@
     7.4 +#ifndef SFMT_PARAMS1279_H
     7.5 +#define SFMT_PARAMS1279_H
     7.6 +
     7.7 +#define POS1	7
     7.8 +#define SL1	14
     7.9 +#define SL2	3
    7.10 +#define SR1	5
    7.11 +#define SR2	1
    7.12 +#define MSK1	0xf7fefffdU
    7.13 +#define MSK2	0x7fefcfffU
    7.14 +#define MSK3	0xaff3ef3fU
    7.15 +#define MSK4	0xb5ffff7fU
    7.16 +#define PARITY1	0x00000001U
    7.17 +#define PARITY2	0x00000000U
    7.18 +#define PARITY3	0x00000000U
    7.19 +#define PARITY4	0x20000000U
    7.20 +
    7.21 +
    7.22 +/* PARAMETERS FOR ALTIVEC */
    7.23 +#if defined(__APPLE__)	/* For OSX */
    7.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
    7.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
    7.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
    7.27 +    #define ALTI_MSK64 \
    7.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
    7.29 +    #define ALTI_SL2_PERM \
    7.30 +	(vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
    7.31 +    #define ALTI_SL2_PERM64 \
    7.32 +	(vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
    7.33 +    #define ALTI_SR2_PERM \
    7.34 +	(vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
    7.35 +    #define ALTI_SR2_PERM64 \
    7.36 +	(vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
    7.37 +#else	/* For OTHER OSs(Linux?) */
    7.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
    7.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
    7.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
    7.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
    7.42 +    #define ALTI_SL2_PERM	{3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
    7.43 +    #define ALTI_SL2_PERM64	{3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
    7.44 +    #define ALTI_SR2_PERM	{7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
    7.45 +    #define ALTI_SR2_PERM64	{15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
    7.46 +#endif	/* For OSX */
    7.47 +#define IDSTR	"SFMT-1279:7-14-3-5-1:f7fefffd-7fefcfff-aff3ef3f-b5ffff7f"
    7.48 +
    7.49 +#endif /* SFMT_PARAMS1279_H */
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/SFMT/SFMT-params132049.h	Sun Mar 04 17:38:32 2012 -0600
     8.3 @@ -0,0 +1,46 @@
     8.4 +#ifndef SFMT_PARAMS132049_H
     8.5 +#define SFMT_PARAMS132049_H
     8.6 +
     8.7 +#define POS1	110
     8.8 +#define SL1	19
     8.9 +#define SL2	1
    8.10 +#define SR1	21
    8.11 +#define SR2	1
    8.12 +#define MSK1	0xffffbb5fU
    8.13 +#define MSK2	0xfb6ebf95U
    8.14 +#define MSK3	0xfffefffaU
    8.15 +#define MSK4	0xcff77fffU
    8.16 +#define PARITY1	0x00000001U
    8.17 +#define PARITY2	0x00000000U
    8.18 +#define PARITY3	0xcb520000U
    8.19 +#define PARITY4	0xc7e91c7dU
    8.20 +
    8.21 +
    8.22 +/* PARAMETERS FOR ALTIVEC */
    8.23 +#if defined(__APPLE__)	/* For OSX */
    8.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
    8.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
    8.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
    8.27 +    #define ALTI_MSK64 \
    8.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
    8.29 +    #define ALTI_SL2_PERM \
    8.30 +	(vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
    8.31 +    #define ALTI_SL2_PERM64 \
    8.32 +	(vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
    8.33 +    #define ALTI_SR2_PERM \
    8.34 +	(vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
    8.35 +    #define ALTI_SR2_PERM64 \
    8.36 +	(vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
    8.37 +#else	/* For OTHER OSs(Linux?) */
    8.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
    8.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
    8.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
    8.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
    8.42 +    #define ALTI_SL2_PERM	{1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
    8.43 +    #define ALTI_SL2_PERM64	{1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
    8.44 +    #define ALTI_SR2_PERM	{7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
    8.45 +    #define ALTI_SR2_PERM64	{15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
    8.46 +#endif	/* For OSX */
    8.47 +#define IDSTR	"SFMT-132049:110-19-1-21-1:ffffbb5f-fb6ebf95-fffefffa-cff77fff"
    8.48 +
    8.49 +#endif /* SFMT_PARAMS132049_H */
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/SFMT/SFMT-params19937.h	Sun Mar 04 17:38:32 2012 -0600
     9.3 @@ -0,0 +1,46 @@
     9.4 +#ifndef SFMT_PARAMS19937_H
     9.5 +#define SFMT_PARAMS19937_H
     9.6 +
     9.7 +#define POS1	122
     9.8 +#define SL1	18
     9.9 +#define SL2	1
    9.10 +#define SR1	11
    9.11 +#define SR2	1
    9.12 +#define MSK1	0xdfffffefU
    9.13 +#define MSK2	0xddfecb7fU
    9.14 +#define MSK3	0xbffaffffU
    9.15 +#define MSK4	0xbffffff6U
    9.16 +#define PARITY1	0x00000001U
    9.17 +#define PARITY2	0x00000000U
    9.18 +#define PARITY3	0x00000000U
    9.19 +#define PARITY4	0x13c9e684U
    9.20 +
    9.21 +
    9.22 +/* PARAMETERS FOR ALTIVEC */
    9.23 +#if defined(__APPLE__)	/* For OSX */
    9.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
    9.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
    9.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
    9.27 +    #define ALTI_MSK64 \
    9.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
    9.29 +    #define ALTI_SL2_PERM \
    9.30 +	(vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
    9.31 +    #define ALTI_SL2_PERM64 \
    9.32 +	(vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
    9.33 +    #define ALTI_SR2_PERM \
    9.34 +	(vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
    9.35 +    #define ALTI_SR2_PERM64 \
    9.36 +	(vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
    9.37 +#else	/* For OTHER OSs(Linux?) */
    9.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
    9.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
    9.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
    9.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
    9.42 +    #define ALTI_SL2_PERM	{1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
    9.43 +    #define ALTI_SL2_PERM64	{1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
    9.44 +    #define ALTI_SR2_PERM	{7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
    9.45 +    #define ALTI_SR2_PERM64	{15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
    9.46 +#endif	/* For OSX */
    9.47 +#define IDSTR	"SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6"
    9.48 +
    9.49 +#endif /* SFMT_PARAMS19937_H */
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/SFMT/SFMT-params216091.h	Sun Mar 04 17:38:32 2012 -0600
    10.3 @@ -0,0 +1,46 @@
    10.4 +#ifndef SFMT_PARAMS216091_H
    10.5 +#define SFMT_PARAMS216091_H
    10.6 +
    10.7 +#define POS1	627
    10.8 +#define SL1	11
    10.9 +#define SL2	3
   10.10 +#define SR1	10
   10.11 +#define SR2	1
   10.12 +#define MSK1	0xbff7bff7U
   10.13 +#define MSK2	0xbfffffffU
   10.14 +#define MSK3	0xbffffa7fU
   10.15 +#define MSK4	0xffddfbfbU
   10.16 +#define PARITY1	0xf8000001U
   10.17 +#define PARITY2	0x89e80709U
   10.18 +#define PARITY3	0x3bd2b64bU
   10.19 +#define PARITY4	0x0c64b1e4U
   10.20 +
   10.21 +
   10.22 +/* PARAMETERS FOR ALTIVEC */
   10.23 +#if defined(__APPLE__)	/* For OSX */
   10.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
   10.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
   10.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
   10.27 +    #define ALTI_MSK64 \
   10.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
   10.29 +    #define ALTI_SL2_PERM \
   10.30 +	(vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
   10.31 +    #define ALTI_SL2_PERM64 \
   10.32 +	(vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
   10.33 +    #define ALTI_SR2_PERM \
   10.34 +	(vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
   10.35 +    #define ALTI_SR2_PERM64 \
   10.36 +	(vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
   10.37 +#else	/* For OTHER OSs(Linux?) */
   10.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
   10.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
   10.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
   10.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
   10.42 +    #define ALTI_SL2_PERM	{3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
   10.43 +    #define ALTI_SL2_PERM64	{3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
   10.44 +    #define ALTI_SR2_PERM	{7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
   10.45 +    #define ALTI_SR2_PERM64	{15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
   10.46 +#endif	/* For OSX */
   10.47 +#define IDSTR	"SFMT-216091:627-11-3-10-1:bff7bff7-bfffffff-bffffa7f-ffddfbfb"
   10.48 +
   10.49 +#endif /* SFMT_PARAMS216091_H */
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/src/SFMT/SFMT-params2281.h	Sun Mar 04 17:38:32 2012 -0600
    11.3 @@ -0,0 +1,46 @@
    11.4 +#ifndef SFMT_PARAMS2281_H
    11.5 +#define SFMT_PARAMS2281_H
    11.6 +
    11.7 +#define POS1	12
    11.8 +#define SL1	19
    11.9 +#define SL2	1
   11.10 +#define SR1	5
   11.11 +#define SR2	1
   11.12 +#define MSK1	0xbff7ffbfU
   11.13 +#define MSK2	0xfdfffffeU
   11.14 +#define MSK3	0xf7ffef7fU
   11.15 +#define MSK4	0xf2f7cbbfU
   11.16 +#define PARITY1	0x00000001U
   11.17 +#define PARITY2	0x00000000U
   11.18 +#define PARITY3	0x00000000U
   11.19 +#define PARITY4	0x41dfa600U
   11.20 +
   11.21 +
   11.22 +/* PARAMETERS FOR ALTIVEC */
   11.23 +#if defined(__APPLE__)	/* For OSX */
   11.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
   11.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
   11.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
   11.27 +    #define ALTI_MSK64 \
   11.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
   11.29 +    #define ALTI_SL2_PERM \
   11.30 +	(vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
   11.31 +    #define ALTI_SL2_PERM64 \
   11.32 +	(vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
   11.33 +    #define ALTI_SR2_PERM \
   11.34 +	(vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
   11.35 +    #define ALTI_SR2_PERM64 \
   11.36 +	(vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
   11.37 +#else	/* For OTHER OSs(Linux?) */
   11.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
   11.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
   11.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
   11.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
   11.42 +    #define ALTI_SL2_PERM	{1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
   11.43 +    #define ALTI_SL2_PERM64	{1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
   11.44 +    #define ALTI_SR2_PERM	{7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
   11.45 +    #define ALTI_SR2_PERM64	{15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
   11.46 +#endif	/* For OSX */
   11.47 +#define IDSTR	"SFMT-2281:12-19-1-5-1:bff7ffbf-fdfffffe-f7ffef7f-f2f7cbbf"
   11.48 +
   11.49 +#endif /* SFMT_PARAMS2281_H */
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/SFMT/SFMT-params4253.h	Sun Mar 04 17:38:32 2012 -0600
    12.3 @@ -0,0 +1,46 @@
    12.4 +#ifndef SFMT_PARAMS4253_H
    12.5 +#define SFMT_PARAMS4253_H
    12.6 +
    12.7 +#define POS1	17
    12.8 +#define SL1	20
    12.9 +#define SL2	1
   12.10 +#define SR1	7
   12.11 +#define SR2	1
   12.12 +#define MSK1	0x9f7bffffU
   12.13 +#define MSK2	0x9fffff5fU
   12.14 +#define MSK3	0x3efffffbU
   12.15 +#define MSK4	0xfffff7bbU
   12.16 +#define PARITY1	0xa8000001U
   12.17 +#define PARITY2	0xaf5390a3U
   12.18 +#define PARITY3	0xb740b3f8U
   12.19 +#define PARITY4	0x6c11486dU
   12.20 +
   12.21 +
   12.22 +/* PARAMETERS FOR ALTIVEC */
   12.23 +#if defined(__APPLE__)	/* For OSX */
   12.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
   12.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
   12.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
   12.27 +    #define ALTI_MSK64 \
   12.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
   12.29 +    #define ALTI_SL2_PERM \
   12.30 +	(vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
   12.31 +    #define ALTI_SL2_PERM64 \
   12.32 +	(vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
   12.33 +    #define ALTI_SR2_PERM \
   12.34 +	(vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
   12.35 +    #define ALTI_SR2_PERM64 \
   12.36 +	(vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
   12.37 +#else	/* For OTHER OSs(Linux?) */
   12.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
   12.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
   12.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
   12.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
   12.42 +    #define ALTI_SL2_PERM	{1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
   12.43 +    #define ALTI_SL2_PERM64	{1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
   12.44 +    #define ALTI_SR2_PERM	{7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
   12.45 +    #define ALTI_SR2_PERM64	{15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
   12.46 +#endif	/* For OSX */
   12.47 +#define IDSTR	"SFMT-4253:17-20-1-7-1:9f7bffff-9fffff5f-3efffffb-fffff7bb"
   12.48 +
   12.49 +#endif /* SFMT_PARAMS4253_H */
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/SFMT/SFMT-params44497.h	Sun Mar 04 17:38:32 2012 -0600
    13.3 @@ -0,0 +1,46 @@
    13.4 +#ifndef SFMT_PARAMS44497_H
    13.5 +#define SFMT_PARAMS44497_H
    13.6 +
    13.7 +#define POS1	330
    13.8 +#define SL1	5
    13.9 +#define SL2	3
   13.10 +#define SR1	9
   13.11 +#define SR2	3
   13.12 +#define MSK1	0xeffffffbU
   13.13 +#define MSK2	0xdfbebfffU
   13.14 +#define MSK3	0xbfbf7befU
   13.15 +#define MSK4	0x9ffd7bffU
   13.16 +#define PARITY1	0x00000001U
   13.17 +#define PARITY2	0x00000000U
   13.18 +#define PARITY3	0xa3ac4000U
   13.19 +#define PARITY4	0xecc1327aU
   13.20 +
   13.21 +
   13.22 +/* PARAMETERS FOR ALTIVEC */
   13.23 +#if defined(__APPLE__)	/* For OSX */
   13.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
   13.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
   13.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
   13.27 +    #define ALTI_MSK64 \
   13.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
   13.29 +    #define ALTI_SL2_PERM \
   13.30 +	(vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
   13.31 +    #define ALTI_SL2_PERM64 \
   13.32 +	(vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
   13.33 +    #define ALTI_SR2_PERM \
   13.34 +	(vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12)
   13.35 +    #define ALTI_SR2_PERM64 \
   13.36 +	(vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12)
   13.37 +#else	/* For OTHER OSs(Linux?) */
   13.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
   13.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
   13.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
   13.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
   13.42 +    #define ALTI_SL2_PERM	{3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
   13.43 +    #define ALTI_SL2_PERM64	{3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
   13.44 +    #define ALTI_SR2_PERM	{5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12}
   13.45 +    #define ALTI_SR2_PERM64	{13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12}
   13.46 +#endif	/* For OSX */
   13.47 +#define IDSTR	"SFMT-44497:330-5-3-9-3:effffffb-dfbebfff-bfbf7bef-9ffd7bff"
   13.48 +
   13.49 +#endif /* SFMT_PARAMS44497_H */
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/src/SFMT/SFMT-params607.h	Sun Mar 04 17:38:32 2012 -0600
    14.3 @@ -0,0 +1,46 @@
    14.4 +#ifndef SFMT_PARAMS607_H
    14.5 +#define SFMT_PARAMS607_H
    14.6 +
    14.7 +#define POS1	2
    14.8 +#define SL1	15
    14.9 +#define SL2	3
   14.10 +#define SR1	13
   14.11 +#define SR2	3
   14.12 +#define MSK1	0xfdff37ffU
   14.13 +#define MSK2	0xef7f3f7dU
   14.14 +#define MSK3	0xff777b7dU
   14.15 +#define MSK4	0x7ff7fb2fU
   14.16 +#define PARITY1	0x00000001U
   14.17 +#define PARITY2	0x00000000U
   14.18 +#define PARITY3	0x00000000U
   14.19 +#define PARITY4	0x5986f054U
   14.20 +
   14.21 +
   14.22 +/* PARAMETERS FOR ALTIVEC */
   14.23 +#if defined(__APPLE__)	/* For OSX */
   14.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
   14.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
   14.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
   14.27 +    #define ALTI_MSK64 \
   14.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
   14.29 +    #define ALTI_SL2_PERM \
   14.30 +	(vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
   14.31 +    #define ALTI_SL2_PERM64 \
   14.32 +	(vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
   14.33 +    #define ALTI_SR2_PERM \
   14.34 +	(vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12)
   14.35 +    #define ALTI_SR2_PERM64 \
   14.36 +	(vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12)
   14.37 +#else	/* For OTHER OSs(Linux?) */
   14.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
   14.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
   14.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
   14.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
   14.42 +    #define ALTI_SL2_PERM	{3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
   14.43 +    #define ALTI_SL2_PERM64	{3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
   14.44 +    #define ALTI_SR2_PERM	{5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12}
   14.45 +    #define ALTI_SR2_PERM64	{13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12}
   14.46 +#endif	/* For OSX */
   14.47 +#define IDSTR	"SFMT-607:2-15-3-13-3:fdff37ff-ef7f3f7d-ff777b7d-7ff7fb2f"
   14.48 +
   14.49 +#endif /* SFMT_PARAMS607_H */
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/src/SFMT/SFMT-params86243.h	Sun Mar 04 17:38:32 2012 -0600
    15.3 @@ -0,0 +1,46 @@
    15.4 +#ifndef SFMT_PARAMS86243_H
    15.5 +#define SFMT_PARAMS86243_H
    15.6 +
    15.7 +#define POS1	366
    15.8 +#define SL1	6
    15.9 +#define SL2	7
   15.10 +#define SR1	19
   15.11 +#define SR2	1
   15.12 +#define MSK1	0xfdbffbffU
   15.13 +#define MSK2	0xbff7ff3fU
   15.14 +#define MSK3	0xfd77efffU
   15.15 +#define MSK4	0xbf9ff3ffU
   15.16 +#define PARITY1	0x00000001U
   15.17 +#define PARITY2	0x00000000U
   15.18 +#define PARITY3	0x00000000U
   15.19 +#define PARITY4	0xe9528d85U
   15.20 +
   15.21 +
   15.22 +/* PARAMETERS FOR ALTIVEC */
   15.23 +#if defined(__APPLE__)	/* For OSX */
   15.24 +    #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
   15.25 +    #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
   15.26 +    #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
   15.27 +    #define ALTI_MSK64 \
   15.28 +	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
   15.29 +    #define ALTI_SL2_PERM \
   15.30 +	(vector unsigned char)(25,25,25,25,3,25,25,25,7,0,1,2,11,4,5,6)
   15.31 +    #define ALTI_SL2_PERM64 \
   15.32 +	(vector unsigned char)(7,25,25,25,25,25,25,25,15,0,1,2,3,4,5,6)
   15.33 +    #define ALTI_SR2_PERM \
   15.34 +	(vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
   15.35 +    #define ALTI_SR2_PERM64 \
   15.36 +	(vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
   15.37 +#else	/* For OTHER OSs(Linux?) */
   15.38 +    #define ALTI_SL1	{SL1, SL1, SL1, SL1}
   15.39 +    #define ALTI_SR1	{SR1, SR1, SR1, SR1}
   15.40 +    #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
   15.41 +    #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
   15.42 +    #define ALTI_SL2_PERM	{25,25,25,25,3,25,25,25,7,0,1,2,11,4,5,6}
   15.43 +    #define ALTI_SL2_PERM64	{7,25,25,25,25,25,25,25,15,0,1,2,3,4,5,6}
   15.44 +    #define ALTI_SR2_PERM	{7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
   15.45 +    #define ALTI_SR2_PERM64	{15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
   15.46 +#endif	/* For OSX */
   15.47 +#define IDSTR	"SFMT-86243:366-6-7-19-1:fdbffbff-bff7ff3f-fd77efff-bf9ff3ff"
   15.48 +
   15.49 +#endif /* SFMT_PARAMS86243_H */
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/src/SFMT/SFMT-sse2.h	Sun Mar 04 17:38:32 2012 -0600
    16.3 @@ -0,0 +1,121 @@
    16.4 +/** 
    16.5 + * @file  SFMT-sse2.h
    16.6 + * @brief SIMD oriented Fast Mersenne Twister(SFMT) for Intel SSE2
    16.7 + *
    16.8 + * @author Mutsuo Saito (Hiroshima University)
    16.9 + * @author Makoto Matsumoto (Hiroshima University)
   16.10 + *
   16.11 + * @note We assume LITTLE ENDIAN in this file
   16.12 + *
   16.13 + * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
   16.14 + * University. All rights reserved.
   16.15 + *
   16.16 + * The new BSD License is applied to this software, see LICENSE.txt
   16.17 + */
   16.18 +
   16.19 +#ifndef SFMT_SSE2_H
   16.20 +#define SFMT_SSE2_H
   16.21 +
   16.22 +PRE_ALWAYS static __m128i mm_recursion(__m128i *a, __m128i *b, __m128i c,
   16.23 +				   __m128i d, __m128i mask) ALWAYSINLINE;
   16.24 +
   16.25 +/**
   16.26 + * This function represents the recursion formula.
   16.27 + * @param a a 128-bit part of the interal state array
   16.28 + * @param b a 128-bit part of the interal state array
   16.29 + * @param c a 128-bit part of the interal state array
   16.30 + * @param d a 128-bit part of the interal state array
   16.31 + * @param mask 128-bit mask
   16.32 + * @return output
   16.33 + */
   16.34 +PRE_ALWAYS static __m128i mm_recursion(__m128i *a, __m128i *b, 
   16.35 +				   __m128i c, __m128i d, __m128i mask) {
   16.36 +    __m128i v, x, y, z;
   16.37 +    
   16.38 +    x = _mm_load_si128(a);
   16.39 +    y = _mm_srli_epi32(*b, SR1);
   16.40 +    z = _mm_srli_si128(c, SR2);
   16.41 +    v = _mm_slli_epi32(d, SL1);
   16.42 +    z = _mm_xor_si128(z, x);
   16.43 +    z = _mm_xor_si128(z, v);
   16.44 +    x = _mm_slli_si128(x, SL2);
   16.45 +    y = _mm_and_si128(y, mask);
   16.46 +    z = _mm_xor_si128(z, x);
   16.47 +    z = _mm_xor_si128(z, y);
   16.48 +    return z;
   16.49 +}
   16.50 +
   16.51 +/**
   16.52 + * This function fills the internal state array with pseudorandom
   16.53 + * integers.
   16.54 + */
   16.55 +inline static void gen_rand_all(void) {
   16.56 +    int i;
   16.57 +    __m128i r, r1, r2, mask;
   16.58 +    mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1);
   16.59 +
   16.60 +    r1 = _mm_load_si128(&sfmt[N - 2].si);
   16.61 +    r2 = _mm_load_si128(&sfmt[N - 1].si);
   16.62 +    for (i = 0; i < N - POS1; i++) {
   16.63 +	r = mm_recursion(&sfmt[i].si, &sfmt[i + POS1].si, r1, r2, mask);
   16.64 +	_mm_store_si128(&sfmt[i].si, r);
   16.65 +	r1 = r2;
   16.66 +	r2 = r;
   16.67 +    }
   16.68 +    for (; i < N; i++) {
   16.69 +	r = mm_recursion(&sfmt[i].si, &sfmt[i + POS1 - N].si, r1, r2, mask);
   16.70 +	_mm_store_si128(&sfmt[i].si, r);
   16.71 +	r1 = r2;
   16.72 +	r2 = r;
   16.73 +    }
   16.74 +}
   16.75 +
   16.76 +/**
   16.77 + * This function fills the user-specified array with pseudorandom
   16.78 + * integers.
   16.79 + *
   16.80 + * @param array an 128-bit array to be filled by pseudorandom numbers.  
   16.81 + * @param size number of 128-bit pesudorandom numbers to be generated.
   16.82 + */
   16.83 +inline static void gen_rand_array(w128_t *array, int size) {
   16.84 +    int i, j;
   16.85 +    __m128i r, r1, r2, mask;
   16.86 +    mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1);
   16.87 +
   16.88 +    r1 = _mm_load_si128(&sfmt[N - 2].si);
   16.89 +    r2 = _mm_load_si128(&sfmt[N - 1].si);
   16.90 +    for (i = 0; i < N - POS1; i++) {
   16.91 +	r = mm_recursion(&sfmt[i].si, &sfmt[i + POS1].si, r1, r2, mask);
   16.92 +	_mm_store_si128(&array[i].si, r);
   16.93 +	r1 = r2;
   16.94 +	r2 = r;
   16.95 +    }
   16.96 +    for (; i < N; i++) {
   16.97 +	r = mm_recursion(&sfmt[i].si, &array[i + POS1 - N].si, r1, r2, mask);
   16.98 +	_mm_store_si128(&array[i].si, r);
   16.99 +	r1 = r2;
  16.100 +	r2 = r;
  16.101 +    }
  16.102 +    /* main loop */
  16.103 +    for (; i < size - N; i++) {
  16.104 +	r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2,
  16.105 +			 mask);
  16.106 +	_mm_store_si128(&array[i].si, r);
  16.107 +	r1 = r2;
  16.108 +	r2 = r;
  16.109 +    }
  16.110 +    for (j = 0; j < 2 * N - size; j++) {
  16.111 +	r = _mm_load_si128(&array[j + size - N].si);
  16.112 +	_mm_store_si128(&sfmt[j].si, r);
  16.113 +    }
  16.114 +    for (; i < size; i++) {
  16.115 +	r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2,
  16.116 +			 mask);
  16.117 +	_mm_store_si128(&array[i].si, r);
  16.118 +	_mm_store_si128(&sfmt[j++].si, r);
  16.119 +	r1 = r2;
  16.120 +	r2 = r;
  16.121 +    }
  16.122 +}
  16.123 +
  16.124 +#endif
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/src/SFMT/SFMT.c	Sun Mar 04 17:38:32 2012 -0600
    17.3 @@ -0,0 +1,620 @@
    17.4 +/** 
    17.5 + * @file  SFMT.c
    17.6 + * @brief SIMD oriented Fast Mersenne Twister(SFMT)
    17.7 + *
    17.8 + * @author Mutsuo Saito (Hiroshima University)
    17.9 + * @author Makoto Matsumoto (Hiroshima University)
   17.10 + *
   17.11 + * Copyright (C) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
   17.12 + * University. All rights reserved.
   17.13 + *
   17.14 + * The new BSD License is applied to this software, see LICENSE.txt
   17.15 + */
   17.16 +#include <string.h>
   17.17 +#include <assert.h>
   17.18 +#include "SFMT.h"
   17.19 +#include "SFMT-params.h"
   17.20 +
   17.21 +#if defined(__BIG_ENDIAN__) && !defined(__amd64) && !defined(BIG_ENDIAN64)
   17.22 +#define BIG_ENDIAN64 1
   17.23 +#endif
   17.24 +#if defined(HAVE_ALTIVEC) && !defined(BIG_ENDIAN64)
   17.25 +#define BIG_ENDIAN64 1
   17.26 +#endif
   17.27 +#if defined(ONLY64) && !defined(BIG_ENDIAN64)
   17.28 +  #if defined(__GNUC__)
   17.29 +    #error "-DONLY64 must be specified with -DBIG_ENDIAN64"
   17.30 +  #endif
   17.31 +#undef ONLY64
   17.32 +#endif
   17.33 +/*------------------------------------------------------
   17.34 +  128-bit SIMD data type for Altivec, SSE2 or standard C
   17.35 +  ------------------------------------------------------*/
   17.36 +#if defined(HAVE_ALTIVEC)
   17.37 +  #if !defined(__APPLE__)
   17.38 +    #include <altivec.h>
   17.39 +  #endif
   17.40 +/** 128-bit data structure */
   17.41 +union W128_T {
   17.42 +    vector unsigned int s;
   17.43 +    uint32_t u[4];
   17.44 +};
   17.45 +/** 128-bit data type */
   17.46 +typedef union W128_T w128_t;
   17.47 +
   17.48 +#elif defined(HAVE_SSE2)
   17.49 +  #include <emmintrin.h>
   17.50 +
   17.51 +/** 128-bit data structure */
   17.52 +union W128_T {
   17.53 +    __m128i si;
   17.54 +    uint32_t u[4];
   17.55 +};
   17.56 +/** 128-bit data type */
   17.57 +typedef union W128_T w128_t;
   17.58 +
   17.59 +#else
   17.60 +
   17.61 +/** 128-bit data structure */
   17.62 +struct W128_T {
   17.63 +    uint32_t u[4];
   17.64 +};
   17.65 +/** 128-bit data type */
   17.66 +typedef struct W128_T w128_t;
   17.67 +
   17.68 +#endif
   17.69 +
   17.70 +/*--------------------------------------
   17.71 +  FILE GLOBAL VARIABLES
   17.72 +  internal state, index counter and flag 
   17.73 +  --------------------------------------*/
   17.74 +/** the 128-bit internal state array */
   17.75 +static w128_t sfmt[N];
   17.76 +/** the 32bit integer pointer to the 128-bit internal state array */
   17.77 +static uint32_t *psfmt32 = &sfmt[0].u[0];
   17.78 +#if !defined(BIG_ENDIAN64) || defined(ONLY64)
   17.79 +/** the 64bit integer pointer to the 128-bit internal state array */
   17.80 +static uint64_t *psfmt64 = (uint64_t *)&sfmt[0].u[0];
   17.81 +#endif
   17.82 +/** index counter to the 32-bit internal state array */
   17.83 +static int idx;
   17.84 +/** a flag: it is 0 if and only if the internal state is not yet
   17.85 + * initialized. */
   17.86 +static int initialized = 0;
   17.87 +/** a parity check vector which certificate the period of 2^{MEXP} */
   17.88 +static uint32_t parity[4] = {PARITY1, PARITY2, PARITY3, PARITY4};
   17.89 +
   17.90 +/*----------------
   17.91 +  STATIC FUNCTIONS
   17.92 +  ----------------*/
   17.93 +inline static int idxof(int i);
   17.94 +inline static void rshift128(w128_t *out,  w128_t const *in, int shift);
   17.95 +inline static void lshift128(w128_t *out,  w128_t const *in, int shift);
   17.96 +inline static void gen_rand_all(void);
   17.97 +inline static void gen_rand_array(w128_t *array, int size);
   17.98 +inline static uint32_t func1(uint32_t x);
   17.99 +inline static uint32_t func2(uint32_t x);
  17.100 +static void period_certification(void);
  17.101 +#if defined(BIG_ENDIAN64) && !defined(ONLY64)
  17.102 +inline static void swap(w128_t *array, int size);
  17.103 +#endif
  17.104 +
  17.105 +#if defined(HAVE_ALTIVEC)
  17.106 +  #include "SFMT-alti.h"
  17.107 +#elif defined(HAVE_SSE2)
  17.108 +  #include "SFMT-sse2.h"
  17.109 +#endif
  17.110 +
  17.111 +/**
  17.112 + * This function simulate a 64-bit index of LITTLE ENDIAN 
  17.113 + * in BIG ENDIAN machine.
  17.114 + */
  17.115 +#ifdef ONLY64
  17.116 +inline static int idxof(int i) {
  17.117 +    return i ^ 1;
  17.118 +}
  17.119 +#else
  17.120 +inline static int idxof(int i) {
  17.121 +    return i;
  17.122 +}
  17.123 +#endif
  17.124 +/**
  17.125 + * This function simulates SIMD 128-bit right shift by the standard C.
  17.126 + * The 128-bit integer given in in is shifted by (shift * 8) bits.
  17.127 + * This function simulates the LITTLE ENDIAN SIMD.
  17.128 + * @param out the output of this function
  17.129 + * @param in the 128-bit data to be shifted
  17.130 + * @param shift the shift value
  17.131 + */
  17.132 +#ifdef ONLY64
  17.133 +inline static void rshift128(w128_t *out, w128_t const *in, int shift) {
  17.134 +    uint64_t th, tl, oh, ol;
  17.135 +
  17.136 +    th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]);
  17.137 +    tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]);
  17.138 +
  17.139 +    oh = th >> (shift * 8);
  17.140 +    ol = tl >> (shift * 8);
  17.141 +    ol |= th << (64 - shift * 8);
  17.142 +    out->u[0] = (uint32_t)(ol >> 32);
  17.143 +    out->u[1] = (uint32_t)(ol & 0xffffffff);
  17.144 +    out->u[2] = (uint32_t)(oh >> 32);
  17.145 +    out->u[3] = (uint32_t)(oh & 0xffffffff);
  17.146 +}
  17.147 +#else
  17.148 +inline static void rshift128(w128_t *out, w128_t const *in, int shift) {
  17.149 +    uint64_t th, tl, oh, ol;
  17.150 +
  17.151 +    th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]);
  17.152 +    tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]);
  17.153 +
  17.154 +    oh = th >> (shift * 8);
  17.155 +    ol = tl >> (shift * 8);
  17.156 +    ol |= th << (64 - shift * 8);
  17.157 +    out->u[1] = (uint32_t)(ol >> 32);
  17.158 +    out->u[0] = (uint32_t)(ol & 0xffffffff);
  17.159 +    out->u[3] = (uint32_t)(oh >> 32);
  17.160 +    out->u[2] = (uint32_t)(oh & 0xffffffff);
  17.161 +}
  17.162 +#endif
  17.163 +/**
  17.164 + * This function simulates SIMD 128-bit left shift by the standard C.
  17.165 + * The 128-bit integer given in in is shifted by (shift * 8) bits.
  17.166 + * This function simulates the LITTLE ENDIAN SIMD.
  17.167 + * @param out the output of this function
  17.168 + * @param in the 128-bit data to be shifted
  17.169 + * @param shift the shift value
  17.170 + */
  17.171 +#ifdef ONLY64
  17.172 +inline static void lshift128(w128_t *out, w128_t const *in, int shift) {
  17.173 +    uint64_t th, tl, oh, ol;
  17.174 +
  17.175 +    th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]);
  17.176 +    tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]);
  17.177 +
  17.178 +    oh = th << (shift * 8);
  17.179 +    ol = tl << (shift * 8);
  17.180 +    oh |= tl >> (64 - shift * 8);
  17.181 +    out->u[0] = (uint32_t)(ol >> 32);
  17.182 +    out->u[1] = (uint32_t)(ol & 0xffffffff);
  17.183 +    out->u[2] = (uint32_t)(oh >> 32);
  17.184 +    out->u[3] = (uint32_t)(oh & 0xffffffff);
  17.185 +}
  17.186 +#else
  17.187 +inline static void lshift128(w128_t *out, w128_t const *in, int shift) {
  17.188 +    uint64_t th, tl, oh, ol;
  17.189 +
  17.190 +    th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]);
  17.191 +    tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]);
  17.192 +
  17.193 +    oh = th << (shift * 8);
  17.194 +    ol = tl << (shift * 8);
  17.195 +    oh |= tl >> (64 - shift * 8);
  17.196 +    out->u[1] = (uint32_t)(ol >> 32);
  17.197 +    out->u[0] = (uint32_t)(ol & 0xffffffff);
  17.198 +    out->u[3] = (uint32_t)(oh >> 32);
  17.199 +    out->u[2] = (uint32_t)(oh & 0xffffffff);
  17.200 +}
  17.201 +#endif
  17.202 +
  17.203 +/**
  17.204 + * This function represents the recursion formula.
  17.205 + * @param r output
  17.206 + * @param a a 128-bit part of the internal state array
  17.207 + * @param b a 128-bit part of the internal state array
  17.208 + * @param c a 128-bit part of the internal state array
  17.209 + * @param d a 128-bit part of the internal state array
  17.210 + */
  17.211 +#if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2))
  17.212 +#ifdef ONLY64
  17.213 +inline static void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *c,
  17.214 +				w128_t *d) {
  17.215 +    w128_t x;
  17.216 +    w128_t y;
  17.217 +
  17.218 +    lshift128(&x, a, SL2);
  17.219 +    rshift128(&y, c, SR2);
  17.220 +    r->u[0] = a->u[0] ^ x.u[0] ^ ((b->u[0] >> SR1) & MSK2) ^ y.u[0] 
  17.221 +	^ (d->u[0] << SL1);
  17.222 +    r->u[1] = a->u[1] ^ x.u[1] ^ ((b->u[1] >> SR1) & MSK1) ^ y.u[1] 
  17.223 +	^ (d->u[1] << SL1);
  17.224 +    r->u[2] = a->u[2] ^ x.u[2] ^ ((b->u[2] >> SR1) & MSK4) ^ y.u[2] 
  17.225 +	^ (d->u[2] << SL1);
  17.226 +    r->u[3] = a->u[3] ^ x.u[3] ^ ((b->u[3] >> SR1) & MSK3) ^ y.u[3] 
  17.227 +	^ (d->u[3] << SL1);
  17.228 +}
  17.229 +#else
  17.230 +inline static void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *c,
  17.231 +				w128_t *d) {
  17.232 +    w128_t x;
  17.233 +    w128_t y;
  17.234 +
  17.235 +    lshift128(&x, a, SL2);
  17.236 +    rshift128(&y, c, SR2);
  17.237 +    r->u[0] = a->u[0] ^ x.u[0] ^ ((b->u[0] >> SR1) & MSK1) ^ y.u[0] 
  17.238 +	^ (d->u[0] << SL1);
  17.239 +    r->u[1] = a->u[1] ^ x.u[1] ^ ((b->u[1] >> SR1) & MSK2) ^ y.u[1] 
  17.240 +	^ (d->u[1] << SL1);
  17.241 +    r->u[2] = a->u[2] ^ x.u[2] ^ ((b->u[2] >> SR1) & MSK3) ^ y.u[2] 
  17.242 +	^ (d->u[2] << SL1);
  17.243 +    r->u[3] = a->u[3] ^ x.u[3] ^ ((b->u[3] >> SR1) & MSK4) ^ y.u[3] 
  17.244 +	^ (d->u[3] << SL1);
  17.245 +}
  17.246 +#endif
  17.247 +#endif
  17.248 +
  17.249 +#if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2))
  17.250 +/**
  17.251 + * This function fills the internal state array with pseudorandom
  17.252 + * integers.
  17.253 + */
  17.254 +inline static void gen_rand_all(void) {
  17.255 +    int i;
  17.256 +    w128_t *r1, *r2;
  17.257 +
  17.258 +    r1 = &sfmt[N - 2];
  17.259 +    r2 = &sfmt[N - 1];
  17.260 +    for (i = 0; i < N - POS1; i++) {
  17.261 +	do_recursion(&sfmt[i], &sfmt[i], &sfmt[i + POS1], r1, r2);
  17.262 +	r1 = r2;
  17.263 +	r2 = &sfmt[i];
  17.264 +    }
  17.265 +    for (; i < N; i++) {
  17.266 +	do_recursion(&sfmt[i], &sfmt[i], &sfmt[i + POS1 - N], r1, r2);
  17.267 +	r1 = r2;
  17.268 +	r2 = &sfmt[i];
  17.269 +    }
  17.270 +}
  17.271 +
  17.272 +/**
  17.273 + * This function fills the user-specified array with pseudorandom
  17.274 + * integers.
  17.275 + *
  17.276 + * @param array an 128-bit array to be filled by pseudorandom numbers.  
  17.277 + * @param size number of 128-bit pseudorandom numbers to be generated.
  17.278 + */
  17.279 +inline static void gen_rand_array(w128_t *array, int size) {
  17.280 +    int i, j;
  17.281 +    w128_t *r1, *r2;
  17.282 +
  17.283 +    r1 = &sfmt[N - 2];
  17.284 +    r2 = &sfmt[N - 1];
  17.285 +    for (i = 0; i < N - POS1; i++) {
  17.286 +	do_recursion(&array[i], &sfmt[i], &sfmt[i + POS1], r1, r2);
  17.287 +	r1 = r2;
  17.288 +	r2 = &array[i];
  17.289 +    }
  17.290 +    for (; i < N; i++) {
  17.291 +	do_recursion(&array[i], &sfmt[i], &array[i + POS1 - N], r1, r2);
  17.292 +	r1 = r2;
  17.293 +	r2 = &array[i];
  17.294 +    }
  17.295 +    for (; i < size - N; i++) {
  17.296 +	do_recursion(&array[i], &array[i - N], &array[i + POS1 - N], r1, r2);
  17.297 +	r1 = r2;
  17.298 +	r2 = &array[i];
  17.299 +    }
  17.300 +    for (j = 0; j < 2 * N - size; j++) {
  17.301 +	sfmt[j] = array[j + size - N];
  17.302 +    }
  17.303 +    for (; i < size; i++, j++) {
  17.304 +	do_recursion(&array[i], &array[i - N], &array[i + POS1 - N], r1, r2);
  17.305 +	r1 = r2;
  17.306 +	r2 = &array[i];
  17.307 +	sfmt[j] = array[i];
  17.308 +    }
  17.309 +}
  17.310 +#endif
  17.311 +
  17.312 +#if defined(BIG_ENDIAN64) && !defined(ONLY64) && !defined(HAVE_ALTIVEC)
  17.313 +inline static void swap(w128_t *array, int size) {
  17.314 +    int i;
  17.315 +    uint32_t x, y;
  17.316 +
  17.317 +    for (i = 0; i < size; i++) {
  17.318 +	x = array[i].u[0];
  17.319 +	y = array[i].u[2];
  17.320 +	array[i].u[0] = array[i].u[1];
  17.321 +	array[i].u[2] = array[i].u[3];
  17.322 +	array[i].u[1] = x;
  17.323 +	array[i].u[3] = y;
  17.324 +    }
  17.325 +}
  17.326 +#endif
  17.327 +/**
  17.328 + * This function represents a function used in the initialization
  17.329 + * by init_by_array
  17.330 + * @param x 32-bit integer
  17.331 + * @return 32-bit integer
  17.332 + */
  17.333 +static uint32_t func1(uint32_t x) {
  17.334 +    return (x ^ (x >> 27)) * (uint32_t)1664525UL;
  17.335 +}
  17.336 +
  17.337 +/**
  17.338 + * This function represents a function used in the initialization
  17.339 + * by init_by_array
  17.340 + * @param x 32-bit integer
  17.341 + * @return 32-bit integer
  17.342 + */
  17.343 +static uint32_t func2(uint32_t x) {
  17.344 +    return (x ^ (x >> 27)) * (uint32_t)1566083941UL;
  17.345 +}
  17.346 +
  17.347 +/**
  17.348 + * This function certificate the period of 2^{MEXP}
  17.349 + */
  17.350 +static void period_certification(void) {
  17.351 +    int inner = 0;
  17.352 +    int i, j;
  17.353 +    uint32_t work;
  17.354 +
  17.355 +    for (i = 0; i < 4; i++)
  17.356 +	inner ^= psfmt32[idxof(i)] & parity[i];
  17.357 +    for (i = 16; i > 0; i >>= 1)
  17.358 +	inner ^= inner >> i;
  17.359 +    inner &= 1;
  17.360 +    /* check OK */
  17.361 +    if (inner == 1) {
  17.362 +	return;
  17.363 +    }
  17.364 +    /* check NG, and modification */
  17.365 +    for (i = 0; i < 4; i++) {
  17.366 +	work = 1;
  17.367 +	for (j = 0; j < 32; j++) {
  17.368 +	    if ((work & parity[i]) != 0) {
  17.369 +		psfmt32[idxof(i)] ^= work;
  17.370 +		return;
  17.371 +	    }
  17.372 +	    work = work << 1;
  17.373 +	}
  17.374 +    }
  17.375 +}
  17.376 +
  17.377 +/*----------------
  17.378 +  PUBLIC FUNCTIONS
  17.379 +  ----------------*/
  17.380 +/**
  17.381 + * This function returns the identification string.
  17.382 + * The string shows the word size, the Mersenne exponent,
  17.383 + * and all parameters of this generator.
  17.384 + */
  17.385 +const char *get_idstring(void) {
  17.386 +    return IDSTR;
  17.387 +}
  17.388 +
  17.389 +/**
  17.390 + * This function returns the minimum size of array used for \b
  17.391 + * fill_array32() function.
  17.392 + * @return minimum size of array used for fill_array32() function.
  17.393 + */
  17.394 +int get_min_array_size32(void) {
  17.395 +    return N32;
  17.396 +}
  17.397 +
  17.398 +/**
  17.399 + * This function returns the minimum size of array used for \b
  17.400 + * fill_array64() function.
  17.401 + * @return minimum size of array used for fill_array64() function.
  17.402 + */
  17.403 +int get_min_array_size64(void) {
  17.404 +    return N64;
  17.405 +}
  17.406 +
  17.407 +#ifndef ONLY64
  17.408 +/**
  17.409 + * This function generates and returns 32-bit pseudorandom number.
  17.410 + * init_gen_rand or init_by_array must be called before this function.
  17.411 + * @return 32-bit pseudorandom number
  17.412 + */
  17.413 +uint32_t gen_rand32(void) {
  17.414 +    uint32_t r;
  17.415 +
  17.416 +    assert(initialized);
  17.417 +    if (idx >= N32) {
  17.418 +	gen_rand_all();
  17.419 +	idx = 0;
  17.420 +    }
  17.421 +    r = psfmt32[idx++];
  17.422 +    return r;
  17.423 +}
  17.424 +#endif
  17.425 +/**
  17.426 + * This function generates and returns 64-bit pseudorandom number.
  17.427 + * init_gen_rand or init_by_array must be called before this function.
  17.428 + * The function gen_rand64 should not be called after gen_rand32,
  17.429 + * unless an initialization is again executed. 
  17.430 + * @return 64-bit pseudorandom number
  17.431 + */
  17.432 +uint64_t gen_rand64(void) {
  17.433 +#if defined(BIG_ENDIAN64) && !defined(ONLY64)
  17.434 +    uint32_t r1, r2;
  17.435 +#else
  17.436 +    uint64_t r;
  17.437 +#endif
  17.438 +
  17.439 +    assert(initialized);
  17.440 +    assert(idx % 2 == 0);
  17.441 +
  17.442 +    if (idx >= N32) {
  17.443 +	gen_rand_all();
  17.444 +	idx = 0;
  17.445 +    }
  17.446 +#if defined(BIG_ENDIAN64) && !defined(ONLY64)
  17.447 +    r1 = psfmt32[idx];
  17.448 +    r2 = psfmt32[idx + 1];
  17.449 +    idx += 2;
  17.450 +    return ((uint64_t)r2 << 32) | r1;
  17.451 +#else
  17.452 +    r = psfmt64[idx / 2];
  17.453 +    idx += 2;
  17.454 +    return r;
  17.455 +#endif
  17.456 +}
  17.457 +
  17.458 +#ifndef ONLY64
  17.459 +/**
  17.460 + * This function generates pseudorandom 32-bit integers in the
  17.461 + * specified array[] by one call. The number of pseudorandom integers
  17.462 + * is specified by the argument size, which must be at least 624 and a
  17.463 + * multiple of four.  The generation by this function is much faster
  17.464 + * than the following gen_rand function.
  17.465 + *
  17.466 + * For initialization, init_gen_rand or init_by_array must be called
  17.467 + * before the first call of this function. This function can not be
  17.468 + * used after calling gen_rand function, without initialization.
  17.469 + *
  17.470 + * @param array an array where pseudorandom 32-bit integers are filled
  17.471 + * by this function.  The pointer to the array must be \b "aligned"
  17.472 + * (namely, must be a multiple of 16) in the SIMD version, since it
  17.473 + * refers to the address of a 128-bit integer.  In the standard C
  17.474 + * version, the pointer is arbitrary.
  17.475 + *
  17.476 + * @param size the number of 32-bit pseudorandom integers to be
  17.477 + * generated.  size must be a multiple of 4, and greater than or equal
  17.478 + * to (MEXP / 128 + 1) * 4.
  17.479 + *
  17.480 + * @note \b memalign or \b posix_memalign is available to get aligned
  17.481 + * memory. Mac OSX doesn't have these functions, but \b malloc of OSX
  17.482 + * returns the pointer to the aligned memory block.
  17.483 + */
  17.484 +void fill_array32(uint32_t *array, int size) {
  17.485 +    assert(initialized);
  17.486 +    assert(idx == N32);
  17.487 +    assert(size % 4 == 0);
  17.488 +    assert(size >= N32);
  17.489 +
  17.490 +    gen_rand_array((w128_t *)array, size / 4);
  17.491 +    idx = N32;
  17.492 +}
  17.493 +#endif
  17.494 +
  17.495 +/**
  17.496 + * This function generates pseudorandom 64-bit integers in the
  17.497 + * specified array[] by one call. The number of pseudorandom integers
  17.498 + * is specified by the argument size, which must be at least 312 and a
  17.499 + * multiple of two.  The generation by this function is much faster
  17.500 + * than the following gen_rand function.
  17.501 + *
  17.502 + * For initialization, init_gen_rand or init_by_array must be called
  17.503 + * before the first call of this function. This function can not be
  17.504 + * used after calling gen_rand function, without initialization.
  17.505 + *
  17.506 + * @param array an array where pseudorandom 64-bit integers are filled
  17.507 + * by this function.  The pointer to the array must be "aligned"
  17.508 + * (namely, must be a multiple of 16) in the SIMD version, since it
  17.509 + * refers to the address of a 128-bit integer.  In the standard C
  17.510 + * version, the pointer is arbitrary.
  17.511 + *
  17.512 + * @param size the number of 64-bit pseudorandom integers to be
  17.513 + * generated.  size must be a multiple of 2, and greater than or equal
  17.514 + * to (MEXP / 128 + 1) * 2
  17.515 + *
  17.516 + * @note \b memalign or \b posix_memalign is available to get aligned
  17.517 + * memory. Mac OSX doesn't have these functions, but \b malloc of OSX
  17.518 + * returns the pointer to the aligned memory block.
  17.519 + */
  17.520 +void fill_array64(uint64_t *array, int size) {
  17.521 +    assert(initialized);
  17.522 +    assert(idx == N32);
  17.523 +    assert(size % 2 == 0);
  17.524 +    assert(size >= N64);
  17.525 +
  17.526 +    gen_rand_array((w128_t *)array, size / 2);
  17.527 +    idx = N32;
  17.528 +
  17.529 +#if defined(BIG_ENDIAN64) && !defined(ONLY64)
  17.530 +    swap((w128_t *)array, size /2);
  17.531 +#endif
  17.532 +}
  17.533 +
  17.534 +/**
  17.535 + * This function initializes the internal state array with a 32-bit
  17.536 + * integer seed.
  17.537 + *
  17.538 + * @param seed a 32-bit integer used as the seed.
  17.539 + */
  17.540 +void init_gen_rand(uint32_t seed) {
  17.541 +    int i;
  17.542 +
  17.543 +    psfmt32[idxof(0)] = seed;
  17.544 +    for (i = 1; i < N32; i++) {
  17.545 +	psfmt32[idxof(i)] = 1812433253UL * (psfmt32[idxof(i - 1)] 
  17.546 +					    ^ (psfmt32[idxof(i - 1)] >> 30))
  17.547 +	    + i;
  17.548 +    }
  17.549 +    idx = N32;
  17.550 +    period_certification();
  17.551 +    initialized = 1;
  17.552 +}
  17.553 +
  17.554 +/**
  17.555 + * This function initializes the internal state array,
  17.556 + * with an array of 32-bit integers used as the seeds
  17.557 + * @param init_key the array of 32-bit integers, used as a seed.
  17.558 + * @param key_length the length of init_key.
  17.559 + */
  17.560 +void init_by_array(uint32_t *init_key, int key_length) {
  17.561 +    int i, j, count;
  17.562 +    uint32_t r;
  17.563 +    int lag;
  17.564 +    int mid;
  17.565 +    int size = N * 4;
  17.566 +
  17.567 +    if (size >= 623) {
  17.568 +	lag = 11;
  17.569 +    } else if (size >= 68) {
  17.570 +	lag = 7;
  17.571 +    } else if (size >= 39) {
  17.572 +	lag = 5;
  17.573 +    } else {
  17.574 +	lag = 3;
  17.575 +    }
  17.576 +    mid = (size - lag) / 2;
  17.577 +
  17.578 +    memset(sfmt, 0x8b, sizeof(sfmt));
  17.579 +    if (key_length + 1 > N32) {
  17.580 +	count = key_length + 1;
  17.581 +    } else {
  17.582 +	count = N32;
  17.583 +    }
  17.584 +    r = func1(psfmt32[idxof(0)] ^ psfmt32[idxof(mid)] 
  17.585 +	      ^ psfmt32[idxof(N32 - 1)]);
  17.586 +    psfmt32[idxof(mid)] += r;
  17.587 +    r += key_length;
  17.588 +    psfmt32[idxof(mid + lag)] += r;
  17.589 +    psfmt32[idxof(0)] = r;
  17.590 +
  17.591 +    count--;
  17.592 +    for (i = 1, j = 0; (j < count) && (j < key_length); j++) {
  17.593 +	r = func1(psfmt32[idxof(i)] ^ psfmt32[idxof((i + mid) % N32)] 
  17.594 +		  ^ psfmt32[idxof((i + N32 - 1) % N32)]);
  17.595 +	psfmt32[idxof((i + mid) % N32)] += r;
  17.596 +	r += init_key[j] + i;
  17.597 +	psfmt32[idxof((i + mid + lag) % N32)] += r;
  17.598 +	psfmt32[idxof(i)] = r;
  17.599 +	i = (i + 1) % N32;
  17.600 +    }
  17.601 +    for (; j < count; j++) {
  17.602 +	r = func1(psfmt32[idxof(i)] ^ psfmt32[idxof((i + mid) % N32)] 
  17.603 +		  ^ psfmt32[idxof((i + N32 - 1) % N32)]);
  17.604 +	psfmt32[idxof((i + mid) % N32)] += r;
  17.605 +	r += i;
  17.606 +	psfmt32[idxof((i + mid + lag) % N32)] += r;
  17.607 +	psfmt32[idxof(i)] = r;
  17.608 +	i = (i + 1) % N32;
  17.609 +    }
  17.610 +    for (j = 0; j < N32; j++) {
  17.611 +	r = func2(psfmt32[idxof(i)] + psfmt32[idxof((i + mid) % N32)] 
  17.612 +		  + psfmt32[idxof((i + N32 - 1) % N32)]);
  17.613 +	psfmt32[idxof((i + mid) % N32)] ^= r;
  17.614 +	r -= i;
  17.615 +	psfmt32[idxof((i + mid + lag) % N32)] ^= r;
  17.616 +	psfmt32[idxof(i)] = r;
  17.617 +	i = (i + 1) % N32;
  17.618 +    }
  17.619 +
  17.620 +    idx = N32;
  17.621 +    period_certification();
  17.622 +    initialized = 1;
  17.623 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/src/SFMT/SFMT.h	Sun Mar 04 17:38:32 2012 -0600
    18.3 @@ -0,0 +1,165 @@
    18.4 +/** 
    18.5 + * @file SFMT.h 
    18.6 + *
    18.7 + * @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom
    18.8 + * number generator
    18.9 + *
   18.10 + * @author Mutsuo Saito (Hiroshima University)
   18.11 + * @author Makoto Matsumoto (Hiroshima University)
   18.12 + *
   18.13 + * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
   18.14 + * University. All rights reserved.
   18.15 + *
   18.16 + * The new BSD License is applied to this software.
   18.17 + * see LICENSE.txt
   18.18 + *
   18.19 + * @note We assume that your system has inttypes.h.  If your system
   18.20 + * doesn't have inttypes.h, you have to typedef uint32_t and uint64_t,
   18.21 + * and you have to define PRIu64 and PRIx64 in this file as follows:
   18.22 + * @verbatim
   18.23 + typedef unsigned int uint32_t
   18.24 + typedef unsigned long long uint64_t  
   18.25 + #define PRIu64 "llu"
   18.26 + #define PRIx64 "llx"
   18.27 +@endverbatim
   18.28 + * uint32_t must be exactly 32-bit unsigned integer type (no more, no
   18.29 + * less), and uint64_t must be exactly 64-bit unsigned integer type.
   18.30 + * PRIu64 and PRIx64 are used for printf function to print 64-bit
   18.31 + * unsigned int and 64-bit unsigned int in hexadecimal format.
   18.32 + */
   18.33 +
   18.34 +#ifndef SFMT_H
   18.35 +#define SFMT_H
   18.36 +
   18.37 +#include <stdio.h>
   18.38 +
   18.39 +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
   18.40 +  #include <inttypes.h>
   18.41 +#elif defined(_MSC_VER) || defined(__BORLANDC__)
   18.42 +  typedef unsigned int uint32_t;
   18.43 +  typedef unsigned __int64 uint64_t;
   18.44 +  #define inline __inline
   18.45 +#else
   18.46 +  #include <inttypes.h>
   18.47 +  #if defined(__GNUC__)
   18.48 +    #define inline __inline__
   18.49 +  #endif
   18.50 +#endif
   18.51 +
   18.52 +#ifndef PRIu64
   18.53 +  #if defined(_MSC_VER) || defined(__BORLANDC__)
   18.54 +    #define PRIu64 "I64u"
   18.55 +    #define PRIx64 "I64x"
   18.56 +  #else
   18.57 +    #define PRIu64 "llu"
   18.58 +    #define PRIx64 "llx"
   18.59 +  #endif
   18.60 +#endif
   18.61 +
   18.62 +#if defined(__GNUC__)
   18.63 +#define ALWAYSINLINE __attribute__((always_inline))
   18.64 +#else
   18.65 +#define ALWAYSINLINE
   18.66 +#endif
   18.67 +
   18.68 +#if defined(_MSC_VER)
   18.69 +  #if _MSC_VER >= 1200
   18.70 +    #define PRE_ALWAYS __forceinline
   18.71 +  #else
   18.72 +    #define PRE_ALWAYS inline
   18.73 +  #endif
   18.74 +#else
   18.75 +  #define PRE_ALWAYS inline
   18.76 +#endif
   18.77 +
   18.78 +#if defined(__cplusplus) || defined(c_plusplus)
   18.79 +//extern "C" {
   18.80 +#endif
   18.81 +
   18.82 +uint32_t gen_rand32(void);
   18.83 +uint64_t gen_rand64(void);
   18.84 +void fill_array32(uint32_t *array, int size);
   18.85 +void fill_array64(uint64_t *array, int size);
   18.86 +void init_gen_rand(uint32_t seed);
   18.87 +void init_by_array(uint32_t *init_key, int key_length);
   18.88 +const char *get_idstring(void);
   18.89 +int get_min_array_size32(void);
   18.90 +int get_min_array_size64(void);
   18.91 +
   18.92 +#if defined(__cplusplus) || defined(c_plusplus)
   18.93 +//} // end extern
   18.94 +#endif
   18.95 +
   18.96 +/* These real versions are due to Isaku Wada */
   18.97 +/** generates a random number on [0,1]-real-interval */
   18.98 +inline static double to_real1(uint32_t v)
   18.99 +{
  18.100 +    return v * (1.0/4294967295.0); 
  18.101 +    /* divided by 2^32-1 */ 
  18.102 +}
  18.103 +
  18.104 +/** generates a random number on [0,1]-real-interval */
  18.105 +inline static double genrand_real1(void)
  18.106 +{
  18.107 +    return to_real1(gen_rand32());
  18.108 +}
  18.109 +
  18.110 +/** generates a random number on [0,1)-real-interval */
  18.111 +inline static double to_real2(uint32_t v)
  18.112 +{
  18.113 +    return v * (1.0/4294967296.0); 
  18.114 +    /* divided by 2^32 */
  18.115 +}
  18.116 +
  18.117 +/** generates a random number on [0,1)-real-interval */
  18.118 +inline static double genrand_real2(void)
  18.119 +{
  18.120 +    return to_real2(gen_rand32());
  18.121 +}
  18.122 +
  18.123 +/** generates a random number on (0,1)-real-interval */
  18.124 +inline static double to_real3(uint32_t v)
  18.125 +{
  18.126 +    return (((double)v) + 0.5)*(1.0/4294967296.0); 
  18.127 +    /* divided by 2^32 */
  18.128 +}
  18.129 +
  18.130 +/** generates a random number on (0,1)-real-interval */
  18.131 +inline static double genrand_real3(void)
  18.132 +{
  18.133 +    return to_real3(gen_rand32());
  18.134 +}
  18.135 +/** These real versions are due to Isaku Wada */
  18.136 +
  18.137 +/** generates a random number on [0,1) with 53-bit resolution*/
  18.138 +inline static double to_res53(uint64_t v) 
  18.139 +{ 
  18.140 +    return v * (1.0/18446744073709551616.0L);
  18.141 +}
  18.142 +
  18.143 +/** generates a random number on [0,1) with 53-bit resolution from two
  18.144 + * 32 bit integers */
  18.145 +inline static double to_res53_mix(uint32_t x, uint32_t y) 
  18.146 +{ 
  18.147 +    return to_res53(x | ((uint64_t)y << 32));
  18.148 +}
  18.149 +
  18.150 +/** generates a random number on [0,1) with 53-bit resolution
  18.151 + */
  18.152 +inline static double genrand_res53(void) 
  18.153 +{ 
  18.154 +    return to_res53(gen_rand64());
  18.155 +} 
  18.156 +
  18.157 +/** generates a random number on [0,1) with 53-bit resolution
  18.158 +    using 32bit integer.
  18.159 + */
  18.160 +inline static double genrand_res53_mix(void) 
  18.161 +{ 
  18.162 +    uint32_t x, y;
  18.163 +
  18.164 +    x = gen_rand32();
  18.165 +    y = gen_rand32();
  18.166 +    return to_res53_mix(x, y);
  18.167 +} 
  18.168 +#endif
    19.1 --- a/src/common/lua-engine.cpp	Sun Mar 04 17:35:30 2012 -0600
    19.2 +++ b/src/common/lua-engine.cpp	Sun Mar 04 17:38:32 2012 -0600
    19.3 @@ -49,10 +49,10 @@
    19.4  
    19.5  extern "C"
    19.6  {
    19.7 -#include "../lua/src/lua.h"
    19.8 -#include "../lua/src/lauxlib.h"
    19.9 -#include "../lua/src/lualib.h"
   19.10 -#include "../lua/src/lstate.h"
   19.11 +#include "../lua/lua.h"
   19.12 +#include "../lua/lauxlib.h"
   19.13 +#include "../lua/lualib.h"
   19.14 +#include "../lua/lstate.h"
   19.15  }
   19.16  #include "vbalua.h"
   19.17