1 /*
2  * This file derives from SFMT 1.3.3
3  * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
4  * released under the terms of the following license:
5  *
6  *   Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
7  *   University. All rights reserved.
8  *
9  *   Redistribution and use in source and binary forms, with or without
10  *   modification, are permitted provided that the following conditions are
11  *   met:
12  *
13  *       * Redistributions of source code must retain the above copyright
14  *         notice, this list of conditions and the following disclaimer.
15  *       * Redistributions in binary form must reproduce the above
16  *         copyright notice, this list of conditions and the following
17  *         disclaimer in the documentation and/or other materials provided
18  *         with the distribution.
19  *       * Neither the name of the Hiroshima University nor the names of
20  *         its contributors may be used to endorse or promote products
21  *         derived from this software without specific prior written
22  *         permission.
23  *
24  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  */
36 #ifndef SFMT_PARAMS_H
37 #define SFMT_PARAMS_H
38 
39 #if !defined(MEXP)
40 #ifdef __GNUC__
41   #warning "MEXP is not defined. I assume MEXP is 19937."
42 #endif
43   #define MEXP 19937
44 #endif
45 /*-----------------
46   BASIC DEFINITIONS
47   -----------------*/
48 /** Mersenne Exponent. The period of the sequence
49  *  is a multiple of 2^MEXP-1.
50  * #define MEXP 19937 */
51 /** SFMT generator has an internal state array of 128-bit integers,
52  * and N is its size. */
53 #define N (MEXP / 128 + 1)
54 /** N32 is the size of internal state array when regarded as an array
55  * of 32-bit integers.*/
56 #define N32 (N * 4)
57 /** N64 is the size of internal state array when regarded as an array
58  * of 64-bit integers.*/
59 #define N64 (N * 2)
60 
61 /*----------------------
62   the parameters of SFMT
63   following definitions are in paramsXXXX.h file.
64   ----------------------*/
65 /** the pick up position of the array.
66 #define POS1 122
67 */
68 
69 /** the parameter of shift left as four 32-bit registers.
70 #define SL1 18
71  */
72 
73 /** the parameter of shift left as one 128-bit register.
74  * The 128-bit integer is shifted by (SL2 * 8) bits.
75 #define SL2 1
76 */
77 
78 /** the parameter of shift right as four 32-bit registers.
79 #define SR1 11
80 */
81 
82 /** the parameter of shift right as one 128-bit register.
83  * The 128-bit integer is shifted by (SL2 * 8) bits.
84 #define SR2 1
85 */
86 
87 /** A bitmask, used in the recursion.  These parameters are introduced
88  * to break symmetry of SIMD.
89 #define MSK1 0xdfffffefU
90 #define MSK2 0xddfecb7fU
91 #define MSK3 0xbffaffffU
92 #define MSK4 0xbffffff6U
93 */
94 
95 /** These definitions are part of a 128-bit period certification vector.
96 #define PARITY1	0x00000001U
97 #define PARITY2	0x00000000U
98 #define PARITY3	0x00000000U
99 #define PARITY4	0xc98e126aU
100 */
101 
102 #if MEXP == 607
103   #include "test/SFMT-params607.h"
104 #elif MEXP == 1279
105   #include "test/SFMT-params1279.h"
106 #elif MEXP == 2281
107   #include "test/SFMT-params2281.h"
108 #elif MEXP == 4253
109   #include "test/SFMT-params4253.h"
110 #elif MEXP == 11213
111   #include "test/SFMT-params11213.h"
112 #elif MEXP == 19937
113   #include "test/SFMT-params19937.h"
114 #elif MEXP == 44497
115   #include "test/SFMT-params44497.h"
116 #elif MEXP == 86243
117   #include "test/SFMT-params86243.h"
118 #elif MEXP == 132049
119   #include "test/SFMT-params132049.h"
120 #elif MEXP == 216091
121   #include "test/SFMT-params216091.h"
122 #else
123 #ifdef __GNUC__
124   #error "MEXP is not valid."
125   #undef MEXP
126 #else
127   #undef MEXP
128 #endif
129 
130 #endif
131 
132 #endif /* SFMT_PARAMS_H */
133