fix non-developer build with assertions
This commit is contained in:
parent
673a73cf76
commit
8c78c5e08c
2 changed files with 3 additions and 1 deletions
|
@ -73,7 +73,7 @@ void rng_make_active(RandomState *rng) {
|
|||
}
|
||||
|
||||
rng_val_t rng_next_p(RandomState *rng) {
|
||||
assert(!rng->locked);
|
||||
assert(!rng_is_locked(rng));
|
||||
return (rng_val_t) { xoshiro256plus(rng->state) };
|
||||
}
|
||||
|
||||
|
|
|
@ -40,9 +40,11 @@ rng_val_t rng_next_p(RandomState *rng) attr_nonnull(1);
|
|||
#ifdef DEBUG
|
||||
INLINE void rng_lock(RandomState *rng) { rng->locked = true; }
|
||||
INLINE void rng_unlock(RandomState *rng) { rng->locked = false; }
|
||||
INLINE bool rng_is_locked(RandomState *rng) { return rng->locked; }
|
||||
#else
|
||||
#define rng_lock(rng) (rng, (void)0)
|
||||
#define rng_unlock(rng) (rng, (void)0)
|
||||
#define rng_is_locked(rng) (false)
|
||||
#endif
|
||||
|
||||
// NOTE: if you rename this, also update scripts/upkeep/check-rng-usage.py!
|
||||
|
|
Loading…
Reference in a new issue