Changeset 12c1eef for libcfa/src/concurrency/kernel/fwd.hfa
- Timestamp:
- Jan 19, 2022, 2:36:56 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 97c215f
- Parents:
- 5235d49 (diff), 6a33e40 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
libcfa/src/concurrency/kernel/fwd.hfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/fwd.hfa
r5235d49 r12c1eef 77 77 78 78 static inline uint64_t __tls_rand() { 79 return 79 80 #if defined(__SIZEOF_INT128__) 80 return __lehmer64( kernelTLS().rand_seed );81 lehmer64( kernelTLS().rand_seed ); 81 82 #else 82 return __xorshift64( kernelTLS().rand_seed );83 xorshift_13_7_17( kernelTLS().rand_seed ); 83 84 #endif 84 85 } 85 86 86 #define M (1_l64u << 48_l64u)87 #define A (25214903917_l64u)88 #define AI (18446708753438544741_l64u)89 #define C (11_l64u)90 #define D (16_l64u)91 92 87 static inline unsigned __tls_rand_fwd() { 93 94 kernelTLS().ready_rng.fwd_seed = (A * kernelTLS().ready_rng.fwd_seed + C) & (M - 1); 95 return kernelTLS().ready_rng.fwd_seed >> D; 88 return LCGBI_fwd( kernelTLS().ready_rng.fwd_seed ); 96 89 } 97 90 98 91 static inline unsigned __tls_rand_bck() { 99 unsigned int r = kernelTLS().ready_rng.bck_seed >> D; 100 kernelTLS().ready_rng.bck_seed = AI * (kernelTLS().ready_rng.bck_seed - C) & (M - 1); 101 return r; 102 } 103 104 #undef M 105 #undef A 106 #undef AI 107 #undef C 108 #undef D 92 return LCGBI_bck( kernelTLS().ready_rng.bck_seed ); 93 } 109 94 110 95 static inline void __tls_rand_advance_bck(void) { … … 112 97 } 113 98 } 114 115 116 99 117 100 extern void disable_interrupts(); … … 142 125 } 143 126 } 144 145 extern uint64_t thread_rand();146 127 147 128 // Semaphore which only supports a single thread
Note:
See TracChangeset
for help on using the changeset viewer.