--- dSFMT-src-2.2.3/dSFMT.h 2013-12-19 05:37:46.000000000 +0100
+++ dSFMT-src-2.2.3/dSFMT.h 2014-06-28 17:42:33.575799782 +0200
@@ -40,6 +40,7 @@
#include <stdio.h>
#include <assert.h>
+#include <stddef.h>
#if !defined(DSFMT_MEXP)
#ifdef __GNUC__
@@ -180,16 +181,17 @@
extern const int dsfmt_global_mexp;
void dsfmt_gen_rand_all(dsfmt_t *dsfmt);
-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);
-void dsfmt_fill_array_open_open(dsfmt_t *dsfmt, double array[], int size);
-void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], int size);
+void dsfmt_fill_array_open_close(dsfmt_t *dsfmt, double array[], ptrdiff_t size);
+void dsfmt_fill_array_close_open(dsfmt_t *dsfmt, double array[], ptrdiff_t size);
+void dsfmt_fill_array_open_open(dsfmt_t *dsfmt, double array[], ptrdiff_t size);
+void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], ptrdiff_t size);
void dsfmt_chk_init_gen_rand(dsfmt_t *dsfmt, uint32_t seed, int mexp);
void dsfmt_chk_init_by_array(dsfmt_t *dsfmt, uint32_t init_key[],
int key_length, int mexp);
const char *dsfmt_get_idstring(void);
int dsfmt_get_min_array_size(void);
+/*
#if defined(__GNUC__)
# define DSFMT_PRE_INLINE inline static
# define DSFMT_PST_INLINE __attribute__((always_inline))
@@ -200,6 +202,10 @@
# define DSFMT_PRE_INLINE inline static
# define DSFMT_PST_INLINE
#endif
+*/
+#define DSFMT_PRE_INLINE
+#define DSFMT_PST_INLINE
+
DSFMT_PRE_INLINE uint32_t dsfmt_genrand_uint32(dsfmt_t *dsfmt) DSFMT_PST_INLINE;
DSFMT_PRE_INLINE double dsfmt_genrand_close1_open2(dsfmt_t *dsfmt)
DSFMT_PST_INLINE;
@@ -214,13 +220,13 @@
DSFMT_PRE_INLINE double dsfmt_gv_genrand_close_open(void) DSFMT_PST_INLINE;
DSFMT_PRE_INLINE double dsfmt_gv_genrand_open_close(void) DSFMT_PST_INLINE;
DSFMT_PRE_INLINE double dsfmt_gv_genrand_open_open(void) DSFMT_PST_INLINE;
-DSFMT_PRE_INLINE void dsfmt_gv_fill_array_open_close(double array[], int size)
+DSFMT_PRE_INLINE void dsfmt_gv_fill_array_open_close(double array[], ptrdiff_t size)
DSFMT_PST_INLINE;
-DSFMT_PRE_INLINE void dsfmt_gv_fill_array_close_open(double array[], int size)
+DSFMT_PRE_INLINE void dsfmt_gv_fill_array_close_open(double array[], ptrdiff_t size)
DSFMT_PST_INLINE;
-DSFMT_PRE_INLINE void dsfmt_gv_fill_array_open_open(double array[], int size)
+DSFMT_PRE_INLINE void dsfmt_gv_fill_array_open_open(double array[], ptrdiff_t size)
DSFMT_PST_INLINE;
-DSFMT_PRE_INLINE void dsfmt_gv_fill_array_close1_open2(double array[], int size)
+DSFMT_PRE_INLINE void dsfmt_gv_fill_array_close1_open2(double array[], ptrdiff_t size)
DSFMT_PST_INLINE;
DSFMT_PRE_INLINE void dsfmt_gv_init_gen_rand(uint32_t seed) DSFMT_PST_INLINE;
DSFMT_PRE_INLINE void dsfmt_gv_init_by_array(uint32_t init_key[],
@@ -238,7 +244,7 @@
* @param dsfmt dsfmt internal state date
* @return double precision floating point pseudorandom number
*/
-inline static uint32_t dsfmt_genrand_uint32(dsfmt_t *dsfmt) {
+uint32_t dsfmt_genrand_uint32(dsfmt_t *dsfmt) {
uint32_t r;
uint64_t *psfmt64 = &dsfmt->status[0].u[0];
@@ -259,7 +265,7 @@
* @param dsfmt dsfmt internal state date
* @return double precision floating point pseudorandom number
*/
-inline static double dsfmt_genrand_close1_open2(dsfmt_t *dsfmt) {
+double dsfmt_genrand_close1_open2(dsfmt_t *dsfmt) {
double r;
double *psfmt64 = &dsfmt->status[0].d[0];
@@ -278,7 +284,7 @@
* before this function. This function uses \b global variables.
* @return double precision floating point pseudorandom number
*/
-inline static uint32_t dsfmt_gv_genrand_uint32(void) {
+uint32_t dsfmt_gv_genrand_uint32(void) {
return dsfmt_genrand_uint32(&dsfmt_global_data);
}
@@ -289,7 +295,7 @@
* before this function. This function uses \b global variables.
* @return double precision floating point pseudorandom number
*/
-inline static double dsfmt_gv_genrand_close1_open2(void) {
+double dsfmt_gv_genrand_close1_open2(void) {
return dsfmt_genrand_close1_open2(&dsfmt_global_data);
}
@@ -301,7 +307,7 @@
* @param dsfmt dsfmt internal state date
* @return double precision floating point pseudorandom number
*/
-inline static double dsfmt_genrand_close_open(dsfmt_t *dsfmt) {
+double dsfmt_genrand_close_open(dsfmt_t *dsfmt) {
return dsfmt_genrand_close1_open2(dsfmt) - 1.0;
}
@@ -312,7 +318,7 @@
* before this function. This function uses \b global variables.
* @return double precision floating point pseudorandom number
*/
-inline static double dsfmt_gv_genrand_close_open(void) {
+double dsfmt_gv_genrand_close_open(void) {
return dsfmt_gv_genrand_close1_open2() - 1.0;
}
@@ -324,7 +330,7 @@
* @param dsfmt dsfmt internal state date
* @return double precision floating point pseudorandom number
*/
-inline static double dsfmt_genrand_open_close(dsfmt_t *dsfmt) {
+double dsfmt_genrand_open_close(dsfmt_t *dsfmt) {
return 2.0 - dsfmt_genrand_close1_open2(dsfmt);
}
@@ -335,7 +341,7 @@
* before this function. This function uses \b global variables.
* @return double precision floating point pseudorandom number
*/
-inline static double dsfmt_gv_genrand_open_close(void) {
+double dsfmt_gv_genrand_open_close(void) {
return 2.0 - dsfmt_gv_genrand_close1_open2();
}
@@ -347,7 +353,7 @@
* @param dsfmt dsfmt internal state date
* @return double precision floating point pseudorandom number
*/
-inline static double dsfmt_genrand_open_open(dsfmt_t *dsfmt) {
+double dsfmt_genrand_open_open(dsfmt_t *dsfmt) {
double *dsfmt64 = &dsfmt->status[0].d[0];
union {
double d;
@@ -370,7 +376,7 @@
* before this function. This function uses \b global variables.
* @return double precision floating point pseudorandom number
*/
-inline static double dsfmt_gv_genrand_open_open(void) {
+double dsfmt_gv_genrand_open_open(void) {
return dsfmt_genrand_open_open(&dsfmt_global_data);
}
@@ -385,7 +391,7 @@
* @param size the number of pseudorandom numbers to be generated.
* see also \sa dsfmt_fill_array_close1_open2()
*/
-inline static void dsfmt_gv_fill_array_close1_open2(double array[], int size) {
+void dsfmt_gv_fill_array_close1_open2(double array[], ptrdiff_t size) {
dsfmt_fill_array_close1_open2(&dsfmt_global_data, array, size);
}
@@ -401,7 +407,7 @@
* see also \sa dsfmt_fill_array_close1_open2() and \sa
* dsfmt_gv_fill_array_close1_open2()
*/
-inline static void dsfmt_gv_fill_array_open_close(double array[], int size) {
+void dsfmt_gv_fill_array_open_close(double array[], ptrdiff_t size) {
dsfmt_fill_array_open_close(&dsfmt_global_data, array, size);
}
@@ -417,7 +423,7 @@
* see also \sa dsfmt_fill_array_close1_open2() \sa
* dsfmt_gv_fill_array_close1_open2()
*/
-inline static void dsfmt_gv_fill_array_close_open(double array[], int size) {
+void dsfmt_gv_fill_array_close_open(double array[], ptrdiff_t size) {
dsfmt_fill_array_close_open(&dsfmt_global_data, array, size);
}
@@ -433,7 +439,7 @@
* see also \sa dsfmt_fill_array_close1_open2() \sa
* dsfmt_gv_fill_array_close1_open2()
*/
-inline static void dsfmt_gv_fill_array_open_open(double array[], int size) {
+void dsfmt_gv_fill_array_open_open(double array[], ptrdiff_t size) {
dsfmt_fill_array_open_open(&dsfmt_global_data, array, size);
}
@@ -443,7 +449,7 @@
* @param dsfmt dsfmt state vector.
* @param seed a 32-bit integer used as the seed.
*/
-inline static void dsfmt_init_gen_rand(dsfmt_t *dsfmt, uint32_t seed) {
+void dsfmt_init_gen_rand(dsfmt_t *dsfmt, uint32_t seed) {
dsfmt_chk_init_gen_rand(dsfmt, seed, DSFMT_MEXP);
}
@@ -453,7 +459,7 @@
* @param seed a 32-bit integer used as the seed.
* see also \sa dsfmt_init_gen_rand()
*/
-inline static void dsfmt_gv_init_gen_rand(uint32_t seed) {
+void dsfmt_gv_init_gen_rand(uint32_t seed) {
dsfmt_init_gen_rand(&dsfmt_global_data, seed);
}
@@ -464,7 +470,7 @@
* @param init_key the array of 32-bit integers, used as a seed.
* @param key_length the length of init_key.
*/
-inline static void dsfmt_init_by_array(dsfmt_t *dsfmt, uint32_t init_key[],
+void dsfmt_init_by_array(dsfmt_t *dsfmt, uint32_t init_key[],
int key_length) {
dsfmt_chk_init_by_array(dsfmt, init_key, key_length, DSFMT_MEXP);
}
@@ -477,7 +483,7 @@
* @param key_length the length of init_key.
* see also \sa dsfmt_init_by_array()
*/
-inline static void dsfmt_gv_init_by_array(uint32_t init_key[], int key_length) {
+void dsfmt_gv_init_by_array(uint32_t init_key[], int key_length) {
dsfmt_init_by_array(&dsfmt_global_data, init_key, key_length);
}
@@ -491,13 +497,13 @@
DSFMT_PRE_INLINE double genrand_close_open(void) DSFMT_PST_INLINE;
DSFMT_PRE_INLINE double genrand_open_close(void) DSFMT_PST_INLINE;
DSFMT_PRE_INLINE double genrand_open_open(void) DSFMT_PST_INLINE;
-DSFMT_PRE_INLINE void fill_array_open_close(double array[], int size)
+DSFMT_PRE_INLINE void fill_array_open_close(double array[], ptrdiff_t size)
DSFMT_PST_INLINE;
-DSFMT_PRE_INLINE void fill_array_close_open(double array[], int size)
+DSFMT_PRE_INLINE void fill_array_close_open(double array[], ptrdiff_t size)
DSFMT_PST_INLINE;
-DSFMT_PRE_INLINE void fill_array_open_open(double array[], int size)
+DSFMT_PRE_INLINE void fill_array_open_open(double array[], ptrdiff_t size)
DSFMT_PST_INLINE;
-DSFMT_PRE_INLINE void fill_array_close1_open2(double array[], int size)
+DSFMT_PRE_INLINE void fill_array_close1_open2(double array[], ptrdiff_t size)
DSFMT_PST_INLINE;
/**
@@ -505,7 +511,7 @@
* @return id string.
* see also \sa dsfmt_get_idstring()
*/
-inline static const char *get_idstring(void) {
+const char *get_idstring(void) {
return dsfmt_get_idstring();
}
@@ -514,7 +520,7 @@
* @return minimum size of array used for fill_array functions.
* see also \sa dsfmt_get_min_array_size()
*/
-inline static int get_min_array_size(void) {
+int get_min_array_size(void) {
return dsfmt_get_min_array_size();
}
@@ -523,7 +529,7 @@
* @param seed a 32-bit integer used as the seed.
* see also \sa dsfmt_gv_init_gen_rand(), \sa dsfmt_init_gen_rand().
*/
-inline static void init_gen_rand(uint32_t seed) {
+void init_gen_rand(uint32_t seed) {
dsfmt_gv_init_gen_rand(seed);
}
@@ -533,7 +539,7 @@
* @param key_length the length of init_key.
* see also \sa dsfmt_gv_init_by_array(), \sa dsfmt_init_by_array().
*/
-inline static void init_by_array(uint32_t init_key[], int key_length) {
+void init_by_array(uint32_t init_key[], int key_length) {
dsfmt_gv_init_by_array(init_key, key_length);
}
@@ -543,7 +549,7 @@
* see also \sa dsfmt_genrand_close1_open2() \sa
* dsfmt_gv_genrand_close1_open2()
*/
-inline static double genrand_close1_open2(void) {
+double genrand_close1_open2(void) {
return dsfmt_gv_genrand_close1_open2();
}
@@ -553,7 +559,7 @@
* see also \sa dsfmt_genrand_close_open() \sa
* dsfmt_gv_genrand_close_open()
*/
-inline static double genrand_close_open(void) {
+double genrand_close_open(void) {
return dsfmt_gv_genrand_close_open();
}
@@ -563,7 +569,7 @@
* see also \sa dsfmt_genrand_open_close() \sa
* dsfmt_gv_genrand_open_close()
*/
-inline static double genrand_open_close(void) {
+double genrand_open_close(void) {
return dsfmt_gv_genrand_open_close();
}
@@ -573,7 +579,7 @@
* see also \sa dsfmt_genrand_open_open() \sa
* dsfmt_gv_genrand_open_open()
*/
-inline static double genrand_open_open(void) {
+double genrand_open_open(void) {
return dsfmt_gv_genrand_open_open();
}
@@ -586,7 +592,7 @@
* dsfmt_fill_array_close1_open2(), \sa
* dsfmt_gv_fill_array_close1_open2()
*/
-inline static void fill_array_open_close(double array[], int size) {
+void fill_array_open_close(double array[], ptrdiff_t size) {
dsfmt_gv_fill_array_open_close(array, size);
}
@@ -599,7 +605,7 @@
* dsfmt_fill_array_close1_open2(), \sa
* dsfmt_gv_fill_array_close1_open2()
*/
-inline static void fill_array_close_open(double array[], int size) {
+void fill_array_close_open(double array[], ptrdiff_t size) {
dsfmt_gv_fill_array_close_open(array, size);
}
@@ -612,7 +618,7 @@
* dsfmt_fill_array_close1_open2(), \sa
* dsfmt_gv_fill_array_close1_open2()
*/
-inline static void fill_array_open_open(double array[], int size) {
+void fill_array_open_open(double array[], ptrdiff_t size) {
dsfmt_gv_fill_array_open_open(array, size);
}
@@ -624,7 +630,7 @@
* see also \sa dsfmt_fill_array_close1_open2(), \sa
* dsfmt_gv_fill_array_close1_open2()
*/
-inline static void fill_array_close1_open2(double array[], int size) {
+void fill_array_close1_open2(double array[], ptrdiff_t size) {
dsfmt_gv_fill_array_close1_open2(array, size);
}
#endif /* DSFMT_DO_NOT_USE_OLD_NAMES */
--- dSFMT-src-2.2.3/dSFMT.c 2012-06-29 03:24:27.000000000 -0400
+++ dSFMT-src-2.2.3/dSFMT-patched.c 2012-12-20 12:45:45.000000000 -0500
@@ -32,13 +32,13 @@
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,
- int size);
+ ptrdiff_t size);
inline static void gen_rand_array_c0o1(dsfmt_t *dsfmt, w128_t *array,
- int size);
+ ptrdiff_t size);
inline static void gen_rand_array_o0c1(dsfmt_t *dsfmt, w128_t *array,
- int size);
+ ptrdiff_t size);
inline static void gen_rand_array_o0o1(dsfmt_t *dsfmt, w128_t *array,
- int size);
+ ptrdiff_t size);
inline static int idxof(int i);
static void initial_mask(dsfmt_t *dsfmt);
static void period_certification(dsfmt_t *dsfmt);
@@ -142,8 +142,8 @@
* @param size number of 128-bit pseudorandom numbers to be generated.
*/
inline static void gen_rand_array_c1o2(dsfmt_t *dsfmt, w128_t *array,
- int size) {
- int i, j;
+ ptrdiff_t size) {
+ ptrdiff_t i, j;
w128_t lung;
lung = dsfmt->status[DSFMT_N];
@@ -180,8 +180,8 @@
* @param size number of 128-bit pseudorandom numbers to be generated.
*/
inline static void gen_rand_array_c0o1(dsfmt_t *dsfmt, w128_t *array,
- int size) {
- int i, j;
+ ptrdiff_t size) {
+ ptrdiff_t i, j;
w128_t lung;
lung = dsfmt->status[DSFMT_N];
@@ -223,8 +223,8 @@
* @param size number of 128-bit pseudorandom numbers to be generated.
*/
inline static void gen_rand_array_o0o1(dsfmt_t *dsfmt, w128_t *array,
- int size) {
- int i, j;
+ ptrdiff_t size) {
+ ptrdiff_t i, j;
w128_t lung;
lung = dsfmt->status[DSFMT_N];
@@ -266,8 +266,8 @@
* @param size number of 128-bit pseudorandom numbers to be generated.
*/
inline static void gen_rand_array_o0c1(dsfmt_t *dsfmt, w128_t *array,
- int size) {
- int i, j;
+ ptrdiff_t size) {
+ ptrdiff_t i, j;
w128_t lung;
lung = dsfmt->status[DSFMT_N];
@@ -453,7 +453,7 @@
* memory. Mac OSX doesn't have these functions, but \b malloc of OSX
* returns the pointer to the aligned memory block.
*/
-void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], int size) {
+void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], ptrdiff_t size) {
assert(size % 2 == 0);
assert(size >= DSFMT_N64);
gen_rand_array_c1o2(dsfmt, (w128_t *)array, size / 2);
@@ -471,7 +471,7 @@
* @param size the number of pseudorandom numbers to be generated.
* see also \sa fill_array_close1_open2()
*/
-void dsfmt_fill_array_open_close(dsfmt_t *dsfmt, double array[], int size) {
+void dsfmt_fill_array_open_close(dsfmt_t *dsfmt, double array[], ptrdiff_t size) {
assert(size % 2 == 0);
assert(size >= DSFMT_N64);
gen_rand_array_o0c1(dsfmt, (w128_t *)array, size / 2);
@@ -489,7 +489,7 @@
* @param size the number of pseudorandom numbers to be generated.
* see also \sa fill_array_close1_open2()
*/
-void dsfmt_fill_array_close_open(dsfmt_t *dsfmt, double array[], int size) {
+void dsfmt_fill_array_close_open(dsfmt_t *dsfmt, double array[], ptrdiff_t size) {
assert(size % 2 == 0);
assert(size >= DSFMT_N64);
gen_rand_array_c0o1(dsfmt, (w128_t *)array, size / 2);
@@ -507,7 +507,7 @@
* @param size the number of pseudorandom numbers to be generated.
* see also \sa fill_array_close1_open2()
*/
-void dsfmt_fill_array_open_open(dsfmt_t *dsfmt, double array[], int size) {
+void dsfmt_fill_array_open_open(dsfmt_t *dsfmt, double array[], ptrdiff_t size) {
assert(size % 2 == 0);
assert(size >= DSFMT_N64);
gen_rand_array_o0o1(dsfmt, (w128_t *)array, size / 2);