1 /* src/toolbox/bitvector.h - bitvector header
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
8 This file is part of CACAO.
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.
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.
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
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Christian Ullrich
39 /* define BV_DEBUG_CHECK to activate the bound checks */
41 /* #define BV_DEBUG_CHECK */
43 /* no debug messages implemented till now */
45 /* #define BV_DEBUG_VERBOSE */
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));
52 #define _BV_CHECK_BOUNDS(i,l,h);
53 #define _BV_ASSERT(a);
55 typedef int *bitvector;
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);
68 /* copy the whole bitvector */
70 void bv_copy(bitvector dst, bitvector src, int size);
74 void bv_minus(bitvector d, bitvector s1, bitvector s2, int size);
78 void bv_union(bitvector d, bitvector s1, bitvector s2, int size);
80 #endif /* _BITVECTOR_H */
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 * ---------------------------------------------------------------------