50 #include <immintrin.h> 79 ((uint64_t)in
.u[3]<<32)|((uint64_t)in
.u[2]);
82 ((uint64_t)in
.u[1]<<32)|((uint64_t)in
.u[0]);
86 if constexpr(LeftRight==RIGHT)
109 (uint32_t)(oh>>32)}};
137 static constexpr uint32_t SL1=
140 static constexpr uint32_t SL2=
143 static constexpr uint32_t SR1=
146 static constexpr uint32_t SR2=
149 static constexpr w128_t MSK=
158 shift128<LEFT>(a,SL2);
160 shift128<RIGHT>(c,SR2);
164 a.u[i]^x.u[i]^((b.u[i]>>SR1)&MSK.u[i])
165 ^y.u[i]^(d.u[i]<<SL1);
170 _mm_xor_si128(_mm_xor_si128(_mm_xor_si128(_mm_xor_si128(_mm_srli_si128(c.si,
177 _mm_and_si128(_mm_srli_epi32(b.si,
190 uint32_t *psfmt32=&state[0].u[0];
192 constexpr uint32_t parity[4]=
200 psfmt32[i]&parity[i];
202 for(
int i=16;i>0;i>>=1)
216 while((
not fixed)
and (i<4))
224 while((
not fixed)
and (j<32))
226 if((work&parity[i])!=0)
248 static constexpr
int POS1=
259 recursion(state[i],state[i],
260 state[(i+POS1)%N],r1,r2);
289 void seed(
const uint32_t& seed)
297 for(
int i=1;i<N32;i++)
void periodCertification()
Certificate the period of 2^MEXP.
w128_t shift128(const w128_t &in, const int &shift)
Emulates the SIMD implementation.
uint32_t operator()()
Gets the next random number in the stream.
int idx
Counter to the 32-bit internal state array.
LEFT_RIGHT_T
Used to shift left or right.
w128_t state[N]
State array.
static constexpr int N32
Number of 32-bit words.
uint32_t u[4]
Inner access.
void seed(const uint32_t &seed)
Seed the state with a 32-bit integer seed.
decltype(auto) operator+(T1 &&smet1, T2 &&smet2)
Implement smet1+smet2.
#define USE_SIMD_MERSENNE_TWISTER
void randomizeAll()
Generates a new state.
void recursion(w128_t &r, w128_t &a, w128_t &b, w128_t &c, w128_t &d)
Performs the recursion.