Changeset 3770b87 for libcfa


Ignore:
Timestamp:
Oct 8, 2023, 9:37:35 AM (7 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
be8ee65
Parents:
92211d9
Message:

formatting, add PRNG copy to checkpoint PRNG state, remove autogen PRNG copy constructor and assignment to prevent accidental PRNG copy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdlib.hfa

    r92211d9 r3770b87  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Sep  2 18:29:35 2023
    13 // Update Count     : 780
     12// Last Modified On : Sun Oct  8 09:18:28 2023
     13// Update Count     : 789
    1414//
    1515
     
    431431        uint32_t seed;                                                                          // current seed
    432432        PRNG_STATE_32_T state;                                                          // random state
    433 }; // PRNG
     433}; // PRNG32
    434434
    435435static inline {
     
    442442        uint32_t prng( PRNG32 & prng, uint32_t l, uint32_t u ) __attribute__(( warn_unused_result )) { return prng( prng, u - l + 1 ) + l; } // [l,u]
    443443        uint32_t calls( PRNG32 & prng ) __attribute__(( warn_unused_result )) with( prng ) { return callcnt; }
    444 } // distribution
     444        void copy( PRNG32 & dst, PRNG32 & src ) { dst = src; } // checkpoint PRNG state, use autogen assignment
     445} // distribution
     446void ?{}( PRNG32 &, PRNG32 & ) = void;                                  // no copy, remove autogen copy constructor
     447PRNG32 & ?=?( PRNG32 &, const PRNG32 ) = void;                  // no assignment, remove autogen assignment
    445448
    446449struct PRNG64 {
     
    448451        uint64_t seed;                                                                          // current seed
    449452        PRNG_STATE_64_T state;                                                          // random state
    450 }; // PRNG
     453}; // PRNG64
    451454
    452455static inline {
     
    459462        uint64_t prng( PRNG64 & prng, uint64_t l, uint64_t u ) __attribute__(( warn_unused_result )) { return prng( prng, u - l + 1 ) + l; } // [l,u]
    460463        uint64_t calls( PRNG64 & prng ) __attribute__(( warn_unused_result )) with( prng ) { return callcnt; }
    461 } // distribution
     464        void copy( PRNG64 & dst, PRNG64 & src ) { dst = src; } // checkpoint PRNG state, use autogen assignment
     465} // distribution
     466void ?{}( PRNG64 &, PRNG64 & ) = void;                                  // no copy, remove autogen copy constructor
     467PRNG64 & ?=?( PRNG64 &, const PRNG64 ) = void;                  // no assignment, remove autogen assignment
    462468
    463469// Set default random-generator size.
Note: See TracChangeset for help on using the changeset viewer.