Skip to content

Commit

Permalink
Fix redefinition of W128_T in dSFMT
Browse files Browse the repository at this point in the history
  • Loading branch information
vigsterkr committed May 6, 2013
1 parent e659378 commit c5f7097
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
10 changes: 5 additions & 5 deletions src/shogun/lib/external/dSFMT/dSFMT-common.h
Expand Up @@ -38,8 +38,8 @@ static const union X128I_T sse2_param_mask = {{DSFMT_MSK1, DSFMT_MSK2}};
#endif

#if defined(HAVE_ALTIVEC)
inline static void do_recursion(w128_t *r, w128_t *a, w128_t * b,
w128_t *lung) {
inline static void do_recursion(dw128_t *r, dw128_t *a, dw128_t * b,
dw128_t *lung) {
const vector unsigned char sl1 = ALTI_SL1;
const vector unsigned char sl1_perm = ALTI_SL1_PERM;
const vector unsigned int sl1_msk = ALTI_SL1_MSK;
Expand Down Expand Up @@ -74,7 +74,7 @@ inline static void do_recursion(w128_t *r, w128_t *a, w128_t * b,
* @param b a 128-bit part of the internal state array
* @param d a 128-bit part of the internal state array (I/O)
*/
inline static void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *u) {
inline static void do_recursion(dw128_t *r, dw128_t *a, dw128_t *b, dw128_t *u) {
__m128i v, w, x, y, z;

x = a->si;
Expand All @@ -98,8 +98,8 @@ inline static void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *u) {
* @param b a 128-bit part of the internal state array
* @param lung a 128-bit part of the internal state array (I/O)
*/
inline static void do_recursion(w128_t *r, w128_t *a, w128_t * b,
w128_t *lung) {
inline static void do_recursion(dw128_t *r, dw128_t *a, dw128_t * b,
dw128_t *lung) {
uint64_t t0, t1, L0, L1;

t0 = a->u[0];
Expand Down
46 changes: 23 additions & 23 deletions src/shogun/lib/external/dSFMT/dSFMT.c
Expand Up @@ -31,13 +31,13 @@ static const int dsfmt_mexp = DSFMT_MEXP;
----------------*/
inline static uint32_t ini_func1(uint32_t x);
inline static uint32_t ini_func2(uint32_t x);
inline static void gen_rand_array_c1o2(dsfmt_t *dsfmt, w128_t *array,
inline static void gen_rand_array_c1o2(dsfmt_t *dsfmt, dw128_t *array,
int size);
inline static void gen_rand_array_c0o1(dsfmt_t *dsfmt, w128_t *array,
inline static void gen_rand_array_c0o1(dsfmt_t *dsfmt, dw128_t *array,
int size);
inline static void gen_rand_array_o0c1(dsfmt_t *dsfmt, w128_t *array,
inline static void gen_rand_array_o0c1(dsfmt_t *dsfmt, dw128_t *array,
int size);
inline static void gen_rand_array_o0o1(dsfmt_t *dsfmt, w128_t *array,
inline static void gen_rand_array_o0o1(dsfmt_t *dsfmt, dw128_t *array,
int size);
inline static int idxof(int i);
static void initial_mask(dsfmt_t *dsfmt);
Expand Down Expand Up @@ -73,7 +73,7 @@ inline static int idxof(int i) {
* in the range [0, 1).
* @param w 128bit stracture of double precision floating point numbers (I/O)
*/
inline static void convert_c0o1(w128_t *w) {
inline static void convert_c0o1(dw128_t *w) {
w->sd = _mm_add_pd(w->sd, sse2_double_m_one.d128);
}

Expand All @@ -83,7 +83,7 @@ inline static void convert_c0o1(w128_t *w) {
* in the range (0, 1].
* @param w 128bit stracture of double precision floating point numbers (I/O)
*/
inline static void convert_o0c1(w128_t *w) {
inline static void convert_o0c1(dw128_t *w) {
w->sd = _mm_sub_pd(sse2_double_two.d128, w->sd);
}

Expand All @@ -93,7 +93,7 @@ inline static void convert_o0c1(w128_t *w) {
* in the range (0, 1).
* @param w 128bit stracture of double precision floating point numbers (I/O)
*/
inline static void convert_o0o1(w128_t *w) {
inline static void convert_o0o1(dw128_t *w) {
w->si = _mm_or_si128(w->si, sse2_int_one.i128);
w->sd = _mm_add_pd(w->sd, sse2_double_m_one.d128);
}
Expand All @@ -104,7 +104,7 @@ inline static void convert_o0o1(w128_t *w) {
* in the range [0, 1).
* @param w 128bit stracture of double precision floating point numbers (I/O)
*/
inline static void convert_c0o1(w128_t *w) {
inline static void convert_c0o1(dw128_t *w) {
w->d[0] -= 1.0;
w->d[1] -= 1.0;
}
Expand All @@ -115,7 +115,7 @@ inline static void convert_c0o1(w128_t *w) {
* in the range (0, 1].
* @param w 128bit stracture of double precision floating point numbers (I/O)
*/
inline static void convert_o0c1(w128_t *w) {
inline static void convert_o0c1(dw128_t *w) {
w->d[0] = 2.0 - w->d[0];
w->d[1] = 2.0 - w->d[1];
}
Expand All @@ -126,7 +126,7 @@ inline static void convert_o0c1(w128_t *w) {
* in the range (0, 1).
* @param w 128bit stracture of double precision floating point numbers (I/O)
*/
inline static void convert_o0o1(w128_t *w) {
inline static void convert_o0o1(dw128_t *w) {
w->u[0] |= 1;
w->u[1] |= 1;
w->d[0] -= 1.0;
Expand All @@ -141,10 +141,10 @@ inline static void convert_o0o1(w128_t *w) {
* @param array an 128-bit array to be filled by pseudorandom numbers.
* @param size number of 128-bit pseudorandom numbers to be generated.
*/
inline static void gen_rand_array_c1o2(dsfmt_t *dsfmt, w128_t *array,
inline static void gen_rand_array_c1o2(dsfmt_t *dsfmt, dw128_t *array,
int size) {
int i, j;
w128_t lung;
dw128_t lung;

lung = dsfmt->status[DSFMT_N];
do_recursion(&array[0], &dsfmt->status[0], &dsfmt->status[DSFMT_POS1],
Expand Down Expand Up @@ -179,10 +179,10 @@ inline static void gen_rand_array_c1o2(dsfmt_t *dsfmt, w128_t *array,
* @param array an 128-bit array to be filled by pseudorandom numbers.
* @param size number of 128-bit pseudorandom numbers to be generated.
*/
inline static void gen_rand_array_c0o1(dsfmt_t *dsfmt, w128_t *array,
inline static void gen_rand_array_c0o1(dsfmt_t *dsfmt, dw128_t *array,
int size) {
int i, j;
w128_t lung;
dw128_t lung;

lung = dsfmt->status[DSFMT_N];
do_recursion(&array[0], &dsfmt->status[0], &dsfmt->status[DSFMT_POS1],
Expand Down Expand Up @@ -222,10 +222,10 @@ inline static void gen_rand_array_c0o1(dsfmt_t *dsfmt, w128_t *array,
* @param array an 128-bit array to be filled by pseudorandom numbers.
* @param size number of 128-bit pseudorandom numbers to be generated.
*/
inline static void gen_rand_array_o0o1(dsfmt_t *dsfmt, w128_t *array,
inline static void gen_rand_array_o0o1(dsfmt_t *dsfmt, dw128_t *array,
int size) {
int i, j;
w128_t lung;
dw128_t lung;

lung = dsfmt->status[DSFMT_N];
do_recursion(&array[0], &dsfmt->status[0], &dsfmt->status[DSFMT_POS1],
Expand Down Expand Up @@ -265,10 +265,10 @@ inline static void gen_rand_array_o0o1(dsfmt_t *dsfmt, w128_t *array,
* @param array an 128-bit array to be filled by pseudorandom numbers.
* @param size number of 128-bit pseudorandom numbers to be generated.
*/
inline static void gen_rand_array_o0c1(dsfmt_t *dsfmt, w128_t *array,
inline static void gen_rand_array_o0c1(dsfmt_t *dsfmt, dw128_t *array,
int size) {
int i, j;
w128_t lung;
dw128_t lung;

lung = dsfmt->status[DSFMT_N];
do_recursion(&array[0], &dsfmt->status[0], &dsfmt->status[DSFMT_POS1],
Expand Down Expand Up @@ -409,7 +409,7 @@ int dsfmt_get_min_array_size(void) {
*/
void dsfmt_gen_rand_all(dsfmt_t *dsfmt) {
int i;
w128_t lung;
dw128_t lung;

lung = dsfmt->status[DSFMT_N];
do_recursion(&dsfmt->status[0], &dsfmt->status[0],
Expand Down Expand Up @@ -456,7 +456,7 @@ void dsfmt_gen_rand_all(dsfmt_t *dsfmt) {
void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], int size) {
assert(size % 2 == 0);
assert(size >= DSFMT_N64);
gen_rand_array_c1o2(dsfmt, (w128_t *)array, size / 2);
gen_rand_array_c1o2(dsfmt, (dw128_t *)array, size / 2);
}

/**
Expand All @@ -474,7 +474,7 @@ void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], int size) {
void dsfmt_fill_array_open_close(dsfmt_t *dsfmt, double array[], int size) {
assert(size % 2 == 0);
assert(size >= DSFMT_N64);
gen_rand_array_o0c1(dsfmt, (w128_t *)array, size / 2);
gen_rand_array_o0c1(dsfmt, (dw128_t *)array, size / 2);
}

/**
Expand All @@ -492,7 +492,7 @@ void dsfmt_fill_array_open_close(dsfmt_t *dsfmt, double array[], int size) {
void dsfmt_fill_array_close_open(dsfmt_t *dsfmt, double array[], int size) {
assert(size % 2 == 0);
assert(size >= DSFMT_N64);
gen_rand_array_c0o1(dsfmt, (w128_t *)array, size / 2);
gen_rand_array_c0o1(dsfmt, (dw128_t *)array, size / 2);
}

/**
Expand All @@ -510,7 +510,7 @@ void dsfmt_fill_array_close_open(dsfmt_t *dsfmt, double array[], int size) {
void dsfmt_fill_array_open_open(dsfmt_t *dsfmt, double array[], int size) {
assert(size % 2 == 0);
assert(size >= DSFMT_N64);
gen_rand_array_o0o1(dsfmt, (w128_t *)array, size / 2);
gen_rand_array_o0o1(dsfmt, (dw128_t *)array, size / 2);
}

#if defined(__INTEL_COMPILER)
Expand Down
10 changes: 5 additions & 5 deletions src/shogun/lib/external/dSFMT/dSFMT.h
Expand Up @@ -136,7 +136,7 @@ typedef unsigned __int64 uint64_t;
# include <altivec.h>
# endif
/** 128-bit data structure */
union W128_T {
union dW128_T {
vector unsigned int s;
uint64_t u[2];
uint32_t u32[4];
Expand All @@ -147,7 +147,7 @@ union W128_T {
# include <emmintrin.h>

/** 128-bit data structure */
union W128_T {
union dW128_T {
__m128i si;
__m128d sd;
uint64_t u[2];
Expand All @@ -156,19 +156,19 @@ union W128_T {
};
#else /* standard C */
/** 128-bit data structure */
union W128_T {
union dW128_T {
uint64_t u[2];
uint32_t u32[4];
double d[2];
};
#endif

/** 128-bit data type */
typedef union W128_T w128_t;
typedef union dW128_T dw128_t;

/** the 128-bit internal state array */
struct DSFMT_T {
w128_t status[DSFMT_N + 1];
dw128_t status[DSFMT_N + 1];
int idx;
};
typedef struct DSFMT_T dsfmt_t;
Expand Down

0 comments on commit c5f7097

Please sign in to comment.