2 #include "lfds710_hash_addonly_internal.h"
8 /****************************************************************************/
9 void lfds710_hash_a_init_valid_on_current_logical_core( struct lfds710_hash_a_state *has,
10 struct lfds710_btree_au_state *baus_array,
11 lfds710_pal_uint_t array_size,
12 int (*key_compare_function)(void const *new_key, void const *existing_key),
13 void (*key_hash_function)(void const *key, lfds710_pal_uint_t *hash),
14 enum lfds710_hash_a_existing_key existing_key,
17 enum lfds710_btree_au_existing_key
18 btree_au_existing_key = LFDS710_BTREE_AU_EXISTING_KEY_OVERWRITE; // TRD : for compiler warning
23 LFDS710_PAL_ASSERT( has != NULL );
24 LFDS710_PAL_ASSERT( baus_array != NULL );
25 LFDS710_PAL_ASSERT( array_size > 0 );
26 LFDS710_PAL_ASSERT( key_compare_function != NULL );
27 LFDS710_PAL_ASSERT( key_hash_function != NULL );
28 // TRD : existing_key can be any value in its range
29 // TRD : user_state can be NULL
31 has->array_size = array_size;
32 has->key_compare_function = key_compare_function;
33 has->key_hash_function = key_hash_function;
34 has->existing_key = existing_key;
35 has->baus_array = baus_array;
36 has->user_state = user_state;
38 if( has->existing_key == LFDS710_HASH_A_EXISTING_KEY_OVERWRITE )
39 btree_au_existing_key = LFDS710_BTREE_AU_EXISTING_KEY_OVERWRITE;
41 if( has->existing_key == LFDS710_HASH_A_EXISTING_KEY_FAIL )
42 btree_au_existing_key = LFDS710_BTREE_AU_EXISTING_KEY_FAIL;
44 // TRD : since the addonly_hash atomic counts, if that flag is set, the btree_addonly_unbalanceds don't have to
45 for( loop = 0 ; loop < array_size ; loop++ )
46 lfds710_btree_au_init_valid_on_current_logical_core( has->baus_array+loop, key_compare_function, btree_au_existing_key, user_state );
48 LFDS710_MISC_BARRIER_STORE;
50 lfds710_misc_force_store();