fix typo so that irnodeset really uses node numbers and not pointers in debug mode
[libfirm] / ir / ir / irnodeset.c
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @author    Matthias Braun
23  * @date      30.03.2007
24  * @brief     A nodeset. This should be prefered over a simple pset, because it
25               tries to guarantee deterministic behavior.
26  * @version   $Id$
27  */
28 #include "config.h"
29
30 #include "irnodeset.h"
31 #include "hashptr.h"
32
33 #define DO_REHASH
34 #define ID_HASH
35 #define HashSet                   ir_nodeset_t
36 #define HashSetIterator           ir_nodeset_iterator_t
37 #define ValueType                 ir_node*
38 #define NullValue                 NULL
39 #define DeletedValue              ((ir_node*)-1)
40 #ifdef DEBUG_libfirm
41 #define Hash(this,value)          (value)->node_nr
42 #else
43 #define Hash(this,value)          HASH_PTR(value)
44 #endif
45 #define KeysEqual(this,key1,key2) (key1) == (key2)
46 #define SetRangeEmpty(ptr,size)   memset(ptr, 0, (size) * sizeof((ptr)[0]))
47
48 #define hashset_init            ir_nodeset_init
49 #define hashset_init_size       ir_nodeset_init_size
50 #define hashset_destroy         ir_nodeset_destroy
51 #define hashset_insert          ir_nodeset_insert
52 #define hashset_remove          ir_nodeset_remove
53 #define hashset_find            _ir_nodeset_find
54 #define hashset_size            ir_nodeset_size
55 #define hashset_iterator_init   ir_nodeset_iterator_init
56 #define hashset_iterator_next   ir_nodeset_iterator_next
57 #define hashset_remove_iterator ir_nodeset_remove_iterator
58
59 #include "hashset.c"
60
61 int ir_nodeset_contains(const ir_nodeset_t *this, const ir_node *node)
62 {
63         return _ir_nodeset_find(this, node) != NULL;
64 }