Changeset c2dfa56a
- Timestamp:
- Mar 20, 2023, 12:05:20 PM (19 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- e62802f
- Parents:
- eac318a
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/random.hfa
reac318a rc2dfa56a 10 10 // Created On : Fri Jan 14 07:18:11 2022 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 22 20:54:22 202213 // Update Count : 1 7812 // Last Modified On : Mon Mar 20 10:01:40 2023 13 // Update Count : 180 14 14 // 15 15 … … 44 44 // Define C/CFA PRNG name and random-state. 45 45 46 // SKULLDUGGERY: typedefs name struct and typedef with the same name to deal with CFA typedef numbering problem.47 48 46 #ifdef XOSHIRO256PP 49 47 #define PRNG_NAME_64 xoshiro256pp 50 48 #define PRNG_STATE_64_T GLUE(PRNG_NAME_64,_t) 51 typedef struct PRNG_STATE_64_T{ uint64_t s0, s1, s2, s3; } PRNG_STATE_64_T;49 typedef struct { uint64_t s0, s1, s2, s3; } PRNG_STATE_64_T; 52 50 #endif // XOSHIRO256PP 53 51 … … 55 53 #define PRNG_NAME_32 xoshiro128pp 56 54 #define PRNG_STATE_32_T GLUE(PRNG_NAME_32,_t) 57 typedef struct PRNG_STATE_32_T{ uint32_t s0, s1, s2, s3; } PRNG_STATE_32_T;55 typedef struct { uint32_t s0, s1, s2, s3; } PRNG_STATE_32_T; 58 56 #endif // XOSHIRO128PP 59 57 … … 86 84 #define PRNG_NAME_64 kiss_64 87 85 #define PRNG_STATE_64_T GLUE(PRNG_NAME_64,_t) 88 typedef struct PRNG_STATE_64_T{ uint64_t z, w, jsr, jcong; } PRNG_STATE_64_T;86 typedef struct { uint64_t z, w, jsr, jcong; } PRNG_STATE_64_T; 89 87 #endif // KISS_^64 90 88 … … 92 90 #define PRNG_NAME_32 xorwow 93 91 #define PRNG_STATE_32_T GLUE(PRNG_NAME_32,_t) 94 typedef struct PRNG_STATE_32_T{ uint32_t a, b, c, d, counter; } PRNG_STATE_32_T;92 typedef struct { uint32_t a, b, c, d, counter; } PRNG_STATE_32_T; 95 93 #endif // XOSHIRO128PP 96 94 … … 130 128 131 129 #ifndef XOSHIRO256PP 132 typedef struct xoshiro256pp_t{ uint64_t s0, s1, s2, s3; } xoshiro256pp_t;130 typedef struct { uint64_t s0, s1, s2, s3; } xoshiro256pp_t; 133 131 #endif // ! XOSHIRO256PP 134 132 … … 152 150 static inline void xoshiro256pp_set_seed( xoshiro256pp_t & state, uint64_t seed ) { 153 151 state = (xoshiro256pp_t){ seed, seed, seed, seed }; 154 xoshiro256pp( state ); 152 xoshiro256pp( state ); // prime 155 153 } // xoshiro256pp_set_seed 156 154 … … 165 163 166 164 #ifndef XOSHIRO128PP 167 typedef struct xoshiro128pp_t{ uint32_t s0, s1, s2, s3; } xoshiro128pp_t;165 typedef struct { uint32_t s0, s1, s2, s3; } xoshiro128pp_t; 168 166 #endif // ! XOSHIRO128PP 169 167 … … 272 270 // The state must be seeded with a nonzero value. 273 271 #ifndef KISS_64 274 typedef struct kiss_64_t{ uint64_t z, w, jsr, jcong; } kiss_64_t;272 typedef struct { uint64_t z, w, jsr, jcong; } kiss_64_t; 275 273 #endif // ! KISS_64 276 274 … … 294 292 // The state array must be initialized to non-zero in the first four words. 295 293 #ifndef XORWOW 296 typedef struct xorwow_t{ uint32_t a, b, c, d, counter; } xorwow_t;294 typedef struct { uint32_t a, b, c, d, counter; } xorwow_t; 297 295 #endif // ! XORWOW 298 296
Note: See TracChangeset
for help on using the changeset viewer.