mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 05:23:56 -07:00
Update SFMT to v1.5.4
This commit is contained in:
parent
9efb262fcf
commit
41182081f4
2 changed files with 21 additions and 4 deletions
|
|
@ -60,7 +60,9 @@ inline static void swap(w128_t *array, int size);
|
||||||
*/
|
*/
|
||||||
static const w128_t sse2_param_mask = {{SFMT_MSK1, SFMT_MSK2,
|
static const w128_t sse2_param_mask = {{SFMT_MSK1, SFMT_MSK2,
|
||||||
SFMT_MSK3, SFMT_MSK4}};
|
SFMT_MSK3, SFMT_MSK4}};
|
||||||
#if defined(_MSC_VER)
|
#if defined(__AVX2__) && (SFMT_SL1 >= 16) && !(SFMT_N & 1) && !(SFMT_POS1 & 1)
|
||||||
|
#include "SFMT-avx256.h"
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
#include "SFMT-sse2-msc.h"
|
#include "SFMT-sse2-msc.h"
|
||||||
#else
|
#else
|
||||||
#include "SFMT-sse2.h"
|
#include "SFMT-sse2.h"
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,13 @@ union W128_T {
|
||||||
uint64_t u64[2];
|
uint64_t u64[2];
|
||||||
uint32x4_t si;
|
uint32x4_t si;
|
||||||
};
|
};
|
||||||
|
//#elif defined(HAVE_SSE2)
|
||||||
#elif defined(HAVE_SSE2)
|
#elif defined(HAVE_SSE2)
|
||||||
#include <emmintrin.h>
|
#if defined(__AVX2__)
|
||||||
|
#include <immintrin.h>
|
||||||
|
#else
|
||||||
|
#include <emmintrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/** 128-bit data structure */
|
/** 128-bit data structure */
|
||||||
union W128_T {
|
union W128_T {
|
||||||
|
|
@ -112,8 +117,18 @@ typedef union W128_T w128_t;
|
||||||
* SFMT internal state
|
* SFMT internal state
|
||||||
*/
|
*/
|
||||||
struct SFMT_T {
|
struct SFMT_T {
|
||||||
|
#if defined(__AVX2__)
|
||||||
|
union {
|
||||||
|
w128_t state[SFMT_N];
|
||||||
|
__m256i state_ymm[SFMT_N/2];
|
||||||
|
#if defined(__AVX512VL__)
|
||||||
|
__m512i state_zmm[SFMT_N/4];
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
#else
|
||||||
/** the 128-bit internal state array */
|
/** the 128-bit internal state array */
|
||||||
w128_t state[SFMT_N];
|
w128_t state[SFMT_N];
|
||||||
|
#endif
|
||||||
/** index counter to the 32-bit internal state array */
|
/** index counter to the 32-bit internal state array */
|
||||||
int idx;
|
int idx;
|
||||||
};
|
};
|
||||||
|
|
@ -249,9 +264,9 @@ inline static double sfmt_genrand_real3(sfmt_t * sfmt)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* converts an unsigned 32-bit integer to double on [0,1)
|
* converts an unsigned 64-bit integer to double on [0,1)
|
||||||
* with 53-bit resolution.
|
* with 53-bit resolution.
|
||||||
* @param v 32-bit unsigned integer
|
* @param v 64-bit unsigned integer
|
||||||
* @return double on [0,1)-real-interval with 53-bit resolution.
|
* @return double on [0,1)-real-interval with 53-bit resolution.
|
||||||
*/
|
*/
|
||||||
inline static double sfmt_to_res53(uint64_t v)
|
inline static double sfmt_to_res53(uint64_t v)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue