indentation changed
[libfirm] / ir / adt / hashset.h
1 /**
2  * @file
3  * @date    16.03.2007
4  * @brief   Generic hashset functions
5  * @author  Matthias Braun
6  * @version $Id$
7  */
8
9 /* You have to specialize this header by defining HashSet, HashSetIterator and
10  * ValueType */
11 #ifdef HashSet
12
13 #include <stdlib.h>
14
15 #ifdef DO_REHASH
16 #define HashSetEntry ValueType
17 #else
18 typedef struct HashSetEntry {
19         ValueType data;
20         unsigned hash;
21 } HashSetEntry;
22 #endif
23
24 typedef struct HashSet {
25         HashSetEntry *entries;
26         size_t num_buckets;
27         size_t enlarge_threshold;
28         size_t shrink_threshold;
29         size_t num_elements;
30         size_t num_deleted;
31         int consider_shrink;
32 #ifndef NDEBUG
33         unsigned entries_version;
34 #endif
35 #ifdef ADDITIONAL_DATA
36         ADDITIONAL_DATA
37 #endif
38 } HashSet;
39
40 typedef struct HashSetIterator {
41         HashSetEntry *current_bucket;
42         HashSetEntry *end;
43 #ifndef NDEBUG
44         const HashSet *set;
45         unsigned entries_version;
46 #endif
47 } HashSetIterator;
48
49 #ifdef DO_REHASH
50 #undef HashSetEntry
51 #endif
52
53 #endif