mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-06 04:04:17 +03:00
Get rid of most of the various inline macros.
This commit is contained in:
parent
7d86c92c61
commit
4d2e4bf5eb
31 changed files with 233 additions and 669 deletions
|
|
@ -81,76 +81,62 @@ const char *get_idstring(void);
|
|||
int get_min_array_size32(void);
|
||||
int get_min_array_size64(void);
|
||||
|
||||
#ifndef JEMALLOC_ENABLE_INLINE
|
||||
double to_real1(uint32_t v);
|
||||
double genrand_real1(sfmt_t *ctx);
|
||||
double to_real2(uint32_t v);
|
||||
double genrand_real2(sfmt_t *ctx);
|
||||
double to_real3(uint32_t v);
|
||||
double genrand_real3(sfmt_t *ctx);
|
||||
double to_res53(uint64_t v);
|
||||
double to_res53_mix(uint32_t x, uint32_t y);
|
||||
double genrand_res53(sfmt_t *ctx);
|
||||
double genrand_res53_mix(sfmt_t *ctx);
|
||||
#endif
|
||||
|
||||
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(SFMT_C_))
|
||||
/* These real versions are due to Isaku Wada */
|
||||
/** generates a random number on [0,1]-real-interval */
|
||||
JEMALLOC_INLINE double to_real1(uint32_t v) {
|
||||
static inline double to_real1(uint32_t v) {
|
||||
return v * (1.0/4294967295.0);
|
||||
/* divided by 2^32-1 */
|
||||
}
|
||||
|
||||
/** generates a random number on [0,1]-real-interval */
|
||||
JEMALLOC_INLINE double genrand_real1(sfmt_t *ctx) {
|
||||
static inline double genrand_real1(sfmt_t *ctx) {
|
||||
return to_real1(gen_rand32(ctx));
|
||||
}
|
||||
|
||||
/** generates a random number on [0,1)-real-interval */
|
||||
JEMALLOC_INLINE double to_real2(uint32_t v) {
|
||||
static inline double to_real2(uint32_t v) {
|
||||
return v * (1.0/4294967296.0);
|
||||
/* divided by 2^32 */
|
||||
}
|
||||
|
||||
/** generates a random number on [0,1)-real-interval */
|
||||
JEMALLOC_INLINE double genrand_real2(sfmt_t *ctx) {
|
||||
static inline double genrand_real2(sfmt_t *ctx) {
|
||||
return to_real2(gen_rand32(ctx));
|
||||
}
|
||||
|
||||
/** generates a random number on (0,1)-real-interval */
|
||||
JEMALLOC_INLINE double to_real3(uint32_t v) {
|
||||
static inline double to_real3(uint32_t v) {
|
||||
return (((double)v) + 0.5)*(1.0/4294967296.0);
|
||||
/* divided by 2^32 */
|
||||
}
|
||||
|
||||
/** generates a random number on (0,1)-real-interval */
|
||||
JEMALLOC_INLINE double genrand_real3(sfmt_t *ctx) {
|
||||
static inline double genrand_real3(sfmt_t *ctx) {
|
||||
return to_real3(gen_rand32(ctx));
|
||||
}
|
||||
/** These real versions are due to Isaku Wada */
|
||||
|
||||
/** generates a random number on [0,1) with 53-bit resolution*/
|
||||
JEMALLOC_INLINE double to_res53(uint64_t v) {
|
||||
static inline double to_res53(uint64_t v) {
|
||||
return v * (1.0/18446744073709551616.0L);
|
||||
}
|
||||
|
||||
/** generates a random number on [0,1) with 53-bit resolution from two
|
||||
* 32 bit integers */
|
||||
JEMALLOC_INLINE double to_res53_mix(uint32_t x, uint32_t y) {
|
||||
static inline double to_res53_mix(uint32_t x, uint32_t y) {
|
||||
return to_res53(x | ((uint64_t)y << 32));
|
||||
}
|
||||
|
||||
/** generates a random number on [0,1) with 53-bit resolution
|
||||
*/
|
||||
JEMALLOC_INLINE double genrand_res53(sfmt_t *ctx) {
|
||||
static inline double genrand_res53(sfmt_t *ctx) {
|
||||
return to_res53(gen_rand64(ctx));
|
||||
}
|
||||
|
||||
/** generates a random number on [0,1) with 53-bit resolution
|
||||
using 32bit integer.
|
||||
*/
|
||||
JEMALLOC_INLINE double genrand_res53_mix(sfmt_t *ctx) {
|
||||
static inline double genrand_res53_mix(sfmt_t *ctx) {
|
||||
uint32_t x, y;
|
||||
|
||||
x = gen_rand32(ctx);
|
||||
|
|
@ -158,4 +144,3 @@ JEMALLOC_INLINE double genrand_res53_mix(sfmt_t *ctx) {
|
|||
return to_res53_mix(x, y);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue