- replaced another large batch of homegrown type use.
This commit is contained in:
parent
6c6bab73ad
commit
6dee9ff566
57 changed files with 656 additions and 656 deletions
|
|
@ -29,7 +29,7 @@
|
|||
#endif
|
||||
|
||||
/** a parity check vector which certificate the period of 2^{MEXP} */
|
||||
static const DWORD parity[4] = { PARITY1, PARITY2, PARITY3, PARITY4 };
|
||||
static const uint32_t parity[4] = { PARITY1, PARITY2, PARITY3, PARITY4 };
|
||||
|
||||
/*----------------
|
||||
STATIC FUNCTIONS
|
||||
|
|
@ -37,8 +37,8 @@ STATIC FUNCTIONS
|
|||
inline static int idxof(int i);
|
||||
inline static void rshift128(w128_t *out, w128_t const *in, int shift);
|
||||
inline static void lshift128(w128_t *out, w128_t const *in, int shift);
|
||||
inline static DWORD func1(DWORD x);
|
||||
inline static DWORD func2(DWORD x);
|
||||
inline static uint32_t func1(uint32_t x);
|
||||
inline static uint32_t func2(uint32_t x);
|
||||
#if defined(BIG_ENDIAN64) && !defined(ONLY64)
|
||||
inline static void swap(w128_t *array, int size);
|
||||
#endif
|
||||
|
|
@ -89,10 +89,10 @@ inline static void rshift128(w128_t *out, w128_t const *in, int shift) {
|
|||
oh = th >> (shift * 8);
|
||||
ol = tl >> (shift * 8);
|
||||
ol |= th << (64 - shift * 8);
|
||||
out->u[0] = (DWORD)(ol >> 32);
|
||||
out->u[1] = (DWORD)ol;
|
||||
out->u[2] = (DWORD)(oh >> 32);
|
||||
out->u[3] = (DWORD)oh;
|
||||
out->u[0] = (uint32_t)(ol >> 32);
|
||||
out->u[1] = (uint32_t)ol;
|
||||
out->u[2] = (uint32_t)(oh >> 32);
|
||||
out->u[3] = (uint32_t)oh;
|
||||
}
|
||||
#else
|
||||
inline static void rshift128(w128_t *out, w128_t const *in, int shift) {
|
||||
|
|
@ -104,10 +104,10 @@ inline static void rshift128(w128_t *out, w128_t const *in, int shift) {
|
|||
oh = th >> (shift * 8);
|
||||
ol = tl >> (shift * 8);
|
||||
ol |= th << (64 - shift * 8);
|
||||
out->u[1] = (DWORD)(ol >> 32);
|
||||
out->u[0] = (DWORD)ol;
|
||||
out->u[3] = (DWORD)(oh >> 32);
|
||||
out->u[2] = (DWORD)oh;
|
||||
out->u[1] = (uint32_t)(ol >> 32);
|
||||
out->u[0] = (uint32_t)ol;
|
||||
out->u[3] = (uint32_t)(oh >> 32);
|
||||
out->u[2] = (uint32_t)oh;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
|
|
@ -128,10 +128,10 @@ inline static void lshift128(w128_t *out, w128_t const *in, int shift) {
|
|||
oh = th << (shift * 8);
|
||||
ol = tl << (shift * 8);
|
||||
oh |= tl >> (64 - shift * 8);
|
||||
out->u[0] = (DWORD)(ol >> 32);
|
||||
out->u[1] = (DWORD)ol;
|
||||
out->u[2] = (DWORD)(oh >> 32);
|
||||
out->u[3] = (DWORD)oh;
|
||||
out->u[0] = (uint32_t)(ol >> 32);
|
||||
out->u[1] = (uint32_t)ol;
|
||||
out->u[2] = (uint32_t)(oh >> 32);
|
||||
out->u[3] = (uint32_t)oh;
|
||||
}
|
||||
#else
|
||||
inline static void lshift128(w128_t *out, w128_t const *in, int shift) {
|
||||
|
|
@ -143,10 +143,10 @@ inline static void lshift128(w128_t *out, w128_t const *in, int shift) {
|
|||
oh = th << (shift * 8);
|
||||
ol = tl << (shift * 8);
|
||||
oh |= tl >> (64 - shift * 8);
|
||||
out->u[1] = (DWORD)(ol >> 32);
|
||||
out->u[0] = (DWORD)ol;
|
||||
out->u[3] = (DWORD)(oh >> 32);
|
||||
out->u[2] = (DWORD)oh;
|
||||
out->u[1] = (uint32_t)(ol >> 32);
|
||||
out->u[0] = (uint32_t)ol;
|
||||
out->u[3] = (uint32_t)(oh >> 32);
|
||||
out->u[2] = (uint32_t)oh;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ void FRandom::GenRandArray(w128_t *array, int size)
|
|||
#if defined(BIG_ENDIAN64) && !defined(ONLY64) && !defined(HAVE_ALTIVEC)
|
||||
inline static void swap(w128_t *array, int size) {
|
||||
int i;
|
||||
DWORD x, y;
|
||||
uint32_t x, y;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
x = array[i].u[0];
|
||||
|
|
@ -282,9 +282,9 @@ inline static void swap(w128_t *array, int size) {
|
|||
* @param x 32-bit integer
|
||||
* @return 32-bit integer
|
||||
*/
|
||||
static DWORD func1(DWORD x)
|
||||
static uint32_t func1(uint32_t x)
|
||||
{
|
||||
return (x ^ (x >> 27)) * (DWORD)1664525UL;
|
||||
return (x ^ (x >> 27)) * (uint32_t)1664525UL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -293,9 +293,9 @@ static DWORD func1(DWORD x)
|
|||
* @param x 32-bit integer
|
||||
* @return 32-bit integer
|
||||
*/
|
||||
static DWORD func2(DWORD x)
|
||||
static uint32_t func2(uint32_t x)
|
||||
{
|
||||
return (x ^ (x >> 27)) * (DWORD)1566083941UL;
|
||||
return (x ^ (x >> 27)) * (uint32_t)1566083941UL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -305,7 +305,7 @@ void FRandom::PeriodCertification()
|
|||
{
|
||||
int inner = 0;
|
||||
int i, j;
|
||||
DWORD work;
|
||||
uint32_t work;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
inner ^= sfmt.u[idxof(i)] & parity[i];
|
||||
|
|
@ -360,7 +360,7 @@ int FRandom::GetMinArraySize64()
|
|||
*/
|
||||
unsigned int FRandom::GenRand32()
|
||||
{
|
||||
DWORD r;
|
||||
uint32_t r;
|
||||
|
||||
assert(initialized);
|
||||
if (idx >= SFMT::N32)
|
||||
|
|
@ -382,7 +382,7 @@ unsigned int FRandom::GenRand32()
|
|||
QWORD FRandom::GenRand64()
|
||||
{
|
||||
#if defined(BIG_ENDIAN64) && !defined(ONLY64)
|
||||
DWORD r1, r2;
|
||||
uint32_t r1, r2;
|
||||
#else
|
||||
QWORD r;
|
||||
#endif
|
||||
|
|
@ -433,7 +433,7 @@ QWORD FRandom::GenRand64()
|
|||
* memory. Mac OSX doesn't have these functions, but \b malloc of OSX
|
||||
* returns the pointer to the aligned memory block.
|
||||
*/
|
||||
void FRandom::FillArray32(DWORD *array, int size)
|
||||
void FRandom::FillArray32(uint32_t *array, int size)
|
||||
{
|
||||
assert(initialized);
|
||||
assert(idx == SFMT::N32);
|
||||
|
|
@ -491,7 +491,7 @@ void FRandom::FillArray64(QWORD *array, int size)
|
|||
*
|
||||
* @param seed a 32-bit integer used as the seed.
|
||||
*/
|
||||
void FRandom::InitGenRand(DWORD seed)
|
||||
void FRandom::InitGenRand(uint32_t seed)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -515,10 +515,10 @@ void FRandom::InitGenRand(DWORD seed)
|
|||
* @param init_key the array of 32-bit integers, used as a seed.
|
||||
* @param key_length the length of init_key.
|
||||
*/
|
||||
void FRandom::InitByArray(DWORD *init_key, int key_length)
|
||||
void FRandom::InitByArray(uint32_t *init_key, int key_length)
|
||||
{
|
||||
int i, j, count;
|
||||
DWORD r;
|
||||
uint32_t r;
|
||||
int lag;
|
||||
int mid;
|
||||
int size = SFMT::N * 4;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue