Ignore:
Timestamp:
Mar 20, 2023, 5:06:26 PM (13 months ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
0e16a2d, 90fb672
Parents:
09965e5
Message:

small comment cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/random.hfa

    r09965e5 r12b006c  
    137137// pseudo-random number generators.                             
    138138static inline uint64_t splitmix64( uint64_t & state ) {
    139     state += 0x9e3779b97f4a7c15;             /* increment the state variable */
    140     uint64_t z = state;                      /* copy the state to a working variable */
    141     z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;  /* xor the variable with the variable right bit shifted 30 then multiply by a constant */
    142     z = (z ^ (z >> 27)) * 0x94d049bb133111eb;  /* xor the variable with the variable right bit shifted 27 then multiply by a constant */
    143     return z ^ (z >> 31);                      /* return the variable xored with itself right bit shifted 31 */
    144 }
     139    state += 0x9e3779b97f4a7c15;
     140    uint64_t z = state;
     141    z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
     142    z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
     143    return z ^ (z >> 31);
     144} // splitmix64
    145145
    146146static inline void splitmix64_set_seed( uint64_t & state , uint64_t seed ) {
    147147    state = seed;
    148148    splitmix64( state );                                                                // prime
    149 } // splitmix32_set_seed
    150 
     149} // splitmix64_set_seed
    151150
    152151// Splitmix32
     
    162161    z = (z ^ (z >> 13)) * 0xc2b2ae35;
    163162    return z ^ (z >> 16);
    164 }
    165 
    166 static inline void splitmix32_set_seed( uint32_t & state , uint64_t seed ) {
     163} // splitmix32
     164
     165static inline void splitmix32_set_seed( uint32_t & state, uint64_t seed ) {
    167166    state = seed;
    168167    splitmix32( state );                                                                // prime
     
    229228static inline void xoshiro256pp_set_seed( xoshiro256pp_t & state, uint64_t seed ) {
    230229    // these are done explicitly in this order to attain repeatable seeding.
    231     // do not call splitmix32 directly in the state init since order of argument evaluation
     230    // do not call splitmix64 directly in the state init since order of argument evaluation
    232231    // may not be consistent leading to irreproducible seeding
    233232    uint64_t seed1 = splitmix64( seed );
Note: See TracChangeset for help on using the changeset viewer.