]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/liblfds710/src/lfds710_prng/lfds710_prng_init.c
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / liblfds710 / src / lfds710_prng / lfds710_prng_init.c
1 /***** includes *****/
2 #include "lfds710_prng_internal.h"
3
4
5
6
7
8 /****************************************************************************/
9 void lfds710_prng_init_valid_on_current_logical_core( struct lfds710_prng_state *ps, lfds710_pal_uint_t seed )
10 {
11   LFDS710_PAL_ASSERT( ps != NULL );
12   LFDS710_PAL_ASSERT( (lfds710_pal_uint_t) &ps->entropy % LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
13   // TRD : seed can be any value in its range (unlike for the mixing function)
14
15   LFDS710_PRNG_ST_MIXING_FUNCTION( seed );
16
17   ps->entropy = seed;
18
19   LFDS710_MISC_BARRIER_STORE;
20
21   lfds710_misc_force_store();
22
23   return;
24 }
25
26
27
28
29
30 /****************************************************************************/
31 void lfds710_prng_st_init( struct lfds710_prng_st_state *psts, lfds710_pal_uint_t seed )
32 {
33   LFDS710_PAL_ASSERT( psts != NULL );
34   LFDS710_PAL_ASSERT( seed != 0 );
35
36   LFDS710_PRNG_ST_MIXING_FUNCTION( seed );
37
38   psts->entropy = seed;
39
40   return;
41 }
42