]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.0.0 / liblfds700 / src / lfds700_btree_addonly_unbalanced / lfds700_btree_addonly_unbalanced_init.c
1 /***** includes *****/
2 #include "lfds700_btree_addonly_unbalanced_internal.h"
3
4
5
6
7
8 /****************************************************************************/
9 void lfds700_btree_au_init_valid_on_current_logical_core( struct lfds700_btree_au_state *baus,
10                                                           int (*key_compare_function)(void const *new_key, void const *existing_key),
11                                                           enum lfds700_btree_au_existing_key existing_key,
12                                                           void *user_state )
13 {
14   LFDS700_PAL_ASSERT( baus != NULL );
15   LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baus->root % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
16   LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baus->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
17   LFDS700_PAL_ASSERT( key_compare_function != NULL );
18   // TRD : existing_key can be any value in its range
19   // TRD : user_state can be NULL
20
21   baus->root = NULL;
22   baus->key_compare_function = key_compare_function;
23   baus->existing_key = existing_key;
24   baus->user_state = user_state;
25
26   LFDS700_MISC_BARRIER_STORE;
27
28   lfds700_misc_force_store();
29
30   return;
31 }
32