Changeset d2ad151 for libcfa/src/bits
- Timestamp:
- Nov 20, 2022, 10:24:14 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 910e1d0
- Parents:
- 25b0fde
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified libcfa/src/bits/random.hfa ¶
r25b0fde rd2ad151 10 10 // Created On : Fri Jan 14 07:18:11 2022 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 14 07:18:58202213 // Update Count : 112 // Last Modified On : Sat Nov 19 17:47:43 2022 13 // Update Count : 8 14 14 // 15 15 … … 18 18 #include <stdint.h> 19 19 20 #ifdef __x86_64__ // 64-bit architecture 21 #define LEHMER64 22 #else // 32-bit architecture 23 #define XORSHIFT_6_21_7 24 #endif // __x86_64__ 25 20 26 // Pipelined to allow out-of-order overlap with reduced dependencies. Critically, the current random state is returned 21 27 // (copied), and then compute and store the next random value. … … 23 29 #if defined(__SIZEOF_INT128__) 24 30 //-------------------------------------------------- 31 #ifdef LEHMER64 32 #define PRNG_ARG_T __uint128_t 33 #define PRNG_NAME lehmer64 34 #endif // LEHMER64 35 25 36 static inline uint64_t lehmer64( __uint128_t & state ) { 26 37 __uint128_t ret = state; … … 51 62 52 63 //-------------------------------------------------- 64 65 #ifdef XORSHIFT_6_21_7 66 #define PRNG_ARG_T uint32_t 67 #define PRNG_NAME xorshift_6_21_7 68 #endif // XORSHIFT_6_21_7 69 53 70 static inline uint32_t xorshift_6_21_7( uint32_t & state ) { 54 71 uint32_t ret = state;
Note: See TracChangeset
for help on using the changeset viewer.