Fix inline-related macro issues.
Add JEMALLOC_INLINE_C and use it instead of JEMALLOC_INLINE in .c files, so that the annotated functions are always static. Remove SFMT's inline-related macros and use jemalloc's instead, so that there's no danger of interactions with jemalloc's definitions that disable inlining for debug builds.
This commit is contained in:
@@ -52,12 +52,6 @@
|
||||
#ifndef SFMT_ALTI_H
|
||||
#define SFMT_ALTI_H
|
||||
|
||||
inline static vector unsigned int vec_recursion(vector unsigned int a,
|
||||
vector unsigned int b,
|
||||
vector unsigned int c,
|
||||
vector unsigned int d)
|
||||
ALWAYSINLINE;
|
||||
|
||||
/**
|
||||
* This function represents the recursion formula in AltiVec and BIG ENDIAN.
|
||||
* @param a a 128-bit part of the interal state array
|
||||
@@ -66,7 +60,8 @@ inline static vector unsigned int vec_recursion(vector unsigned int a,
|
||||
* @param d a 128-bit part of the interal state array
|
||||
* @return output
|
||||
*/
|
||||
inline static vector unsigned int vec_recursion(vector unsigned int a,
|
||||
JEMALLOC_ALWAYS_INLINE
|
||||
static vector unsigned int vec_recursion(vector unsigned int a,
|
||||
vector unsigned int b,
|
||||
vector unsigned int c,
|
||||
vector unsigned int d) {
|
||||
@@ -100,7 +95,7 @@ inline static vector unsigned int vec_recursion(vector unsigned int a,
|
||||
* This function fills the internal state array with pseudorandom
|
||||
* integers.
|
||||
*/
|
||||
inline static void gen_rand_all(sfmt_t *ctx) {
|
||||
JEMALLOC_INLINE void gen_rand_all(sfmt_t *ctx) {
|
||||
int i;
|
||||
vector unsigned int r, r1, r2;
|
||||
|
||||
@@ -127,7 +122,7 @@ inline static void gen_rand_all(sfmt_t *ctx) {
|
||||
* @param array an 128-bit array to be filled by pseudorandom numbers.
|
||||
* @param size number of 128-bit pesudorandom numbers to be generated.
|
||||
*/
|
||||
inline static void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) {
|
||||
JEMALLOC_INLINE void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) {
|
||||
int i, j;
|
||||
vector unsigned int r, r1, r2;
|
||||
|
||||
@@ -178,7 +173,7 @@ inline static void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) {
|
||||
* @param array an 128-bit array to be swaped.
|
||||
* @param size size of 128-bit array.
|
||||
*/
|
||||
inline static void swap(w128_t *array, int size) {
|
||||
JEMALLOC_INLINE void swap(w128_t *array, int size) {
|
||||
int i;
|
||||
const vector unsigned char perm = ALTI_SWAP;
|
||||
|
||||
|
@@ -51,9 +51,6 @@
|
||||
#ifndef SFMT_SSE2_H
|
||||
#define SFMT_SSE2_H
|
||||
|
||||
PRE_ALWAYS static __m128i mm_recursion(__m128i *a, __m128i *b, __m128i c,
|
||||
__m128i d, __m128i mask) ALWAYSINLINE;
|
||||
|
||||
/**
|
||||
* This function represents the recursion formula.
|
||||
* @param a a 128-bit part of the interal state array
|
||||
@@ -63,7 +60,7 @@ PRE_ALWAYS static __m128i mm_recursion(__m128i *a, __m128i *b, __m128i c,
|
||||
* @param mask 128-bit mask
|
||||
* @return output
|
||||
*/
|
||||
PRE_ALWAYS static __m128i mm_recursion(__m128i *a, __m128i *b,
|
||||
JEMALLOC_ALWAYS_INLINE __m128i mm_recursion(__m128i *a, __m128i *b,
|
||||
__m128i c, __m128i d, __m128i mask) {
|
||||
__m128i v, x, y, z;
|
||||
|
||||
@@ -84,7 +81,7 @@ PRE_ALWAYS static __m128i mm_recursion(__m128i *a, __m128i *b,
|
||||
* This function fills the internal state array with pseudorandom
|
||||
* integers.
|
||||
*/
|
||||
inline static void gen_rand_all(sfmt_t *ctx) {
|
||||
JEMALLOC_INLINE void gen_rand_all(sfmt_t *ctx) {
|
||||
int i;
|
||||
__m128i r, r1, r2, mask;
|
||||
mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1);
|
||||
@@ -114,7 +111,7 @@ inline static void gen_rand_all(sfmt_t *ctx) {
|
||||
* @param array an 128-bit array to be filled by pseudorandom numbers.
|
||||
* @param size number of 128-bit pesudorandom numbers to be generated.
|
||||
*/
|
||||
inline static void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) {
|
||||
JEMALLOC_INLINE void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) {
|
||||
int i, j;
|
||||
__m128i r, r1, r2, mask;
|
||||
mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1);
|
||||
|
@@ -66,22 +66,6 @@
|
||||
#ifndef SFMT_H
|
||||
#define SFMT_H
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define ALWAYSINLINE __attribute__((always_inline))
|
||||
#else
|
||||
#define ALWAYSINLINE
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if _MSC_VER >= 1200
|
||||
#define PRE_ALWAYS __forceinline
|
||||
#else
|
||||
#define PRE_ALWAYS inline
|
||||
#endif
|
||||
#else
|
||||
#define PRE_ALWAYS inline
|
||||
#endif
|
||||
|
||||
typedef struct sfmt_s sfmt_t;
|
||||
|
||||
uint32_t gen_rand32(sfmt_t *ctx);
|
||||
|
Reference in New Issue
Block a user