* Removed all Id tags.
[cacao.git] / src / toolbox / bitvector.h
1 /* src/toolbox/bitvector.h - bitvector header
2
3    Copyright (C) 2005, 2006 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Christian Ullrich
28
29
30 */
31
32
33 #ifndef _BITVECTOR_H
34 #define _BITVECTOR_H
35
36 #if !defined(NDEBUG)
37 #include <assert.h>
38
39 /* define BV_DEBUG_CHECK to activate the bound checks */
40
41 /* #define BV_DEBUG_CHECK */
42
43 /* no debug messages implemented till now */
44
45 /* #define BV_DEBUG_VERBOSE */
46 #endif
47
48 #if defined(BV_DEBUG_CHECK)
49 #define _BV_CHECK_BOUNDS(i,l,h) assert( ((i) >= (l)) && ((i) < (h)));
50 #define _BV_ASSERT(a) assert((a));
51 #else
52 #define _BV_CHECK_BOUNDS(i,l,h);
53 #define _BV_ASSERT(a);
54 #endif
55 typedef int *bitvector;
56
57 /* function prototypes */
58 char *bv_to_string(bitvector bv, char *string, int size);
59 bitvector bv_new(int size);           /* Create a new Bitvector for size Bits */
60                                       /* All bits are reset                   */
61 void bv_set_bit(bitvector bv, int bit);    /* set Bit bit of bitvector       */
62 void bv_reset_bit(bitvector bv, int bit);  /* reset Bit bit of bitvector     */
63 void bv_reset(bitvector bv, int size);     /* reset the whole bitvector      */
64 bool bv_is_empty(bitvector bv, int size);  /* Returns if no Bit is set       */
65 bool bv_get_bit(bitvector bv, int bit);    /* Returns if Bit bit is set      */
66 bool bv_equal(bitvector s1, bitvector s2, int size);
67
68 /* copy the whole bitvector    */
69
70 void bv_copy(bitvector dst, bitvector src, int size); 
71
72 /* d = s1 \ s2     */
73
74 void bv_minus(bitvector d, bitvector s1, bitvector s2, int size);
75
76 /* d = s1 union s2 */
77
78 void bv_union(bitvector d, bitvector s1, bitvector s2, int size);
79
80 #endif /* _BITVECTOR_H */
81
82
83 /*
84  * These are local overrides for various environment variables in Emacs.
85  * Please do not remove this and leave it at the end of the file, where
86  * Emacs will automagically detect them.
87  * ---------------------------------------------------------------------
88  * Local variables:
89  * mode: c
90  * indent-tabs-mode: t
91  * c-basic-offset: 4
92  * tab-width: 4
93  * End:
94  */