forked from LPD-EPFL/ASCYLIB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhashtable.h
55 lines (48 loc) · 1.65 KB
/
hashtable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* File: hashtable.h
* Author: Vincent Gramoli <[email protected]>,
* Vasileios Trigonakis <[email protected]>
* Description: a harris_opt list per bucket
* hashtable.h is part of ASCYLIB
*
* Copyright (c) 2014 Vasileios Trigonakis <[email protected]>,
* Tudor David <[email protected]>
* Distributed Programming Lab (LPD), EPFL
*
* ASCYLIB is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2
* of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "./lists/intset.h"
#define DEFAULT_MOVE 0
#define DEFAULT_SNAPSHOT 0
#define DEFAULT_LOAD 1
#define DEFAULT_ELASTICITY 4
#define DEFAULT_ALTERNATE 0
#define DEFAULT_EFFECTIVE 1
#define MAXHTLENGTH 65536
/* Hashtable length (# of buckets) */
extern unsigned int maxhtlength;
/* Hashtable seed */
#ifdef TLS
extern __thread unsigned int *rng_seed;
#else /* ! TLS */
extern pthread_key_t rng_seed_key;
#endif /* ! TLS */
typedef struct ht_intset
{
size_t hash;
intset_t* buckets;
uint8_t padding[CACHE_LINE_SIZE - 16 - sizeof(node_t*)];
} ht_intset_t;
void ht_delete(ht_intset_t *set);
int ht_size(ht_intset_t *set);
int floor_log_2(unsigned int n);
ht_intset_t *ht_new();