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
40 /* define BV_DEBUG_CHECK to activate the bound checks */
42 /* #define BV_DEBUG_CHECK */
44 /* no debug messages implemented till now */
46 /* #define BV_DEBUG_VERBOSE */
49 #if defined(BV_DEBUG_CHECK)
50 #define _BV_CHECK_BOUNDS(i,l,h) assert( ((i) >= (l)) && ((i) < (h)));
51 #define _BV_ASSERT(a) assert((a));
53 #define _BV_CHECK_BOUNDS(i,l,h);
54 #define _BV_ASSERT(a);
56 typedef int *bitvector;
58 /* function prototypes */
59 char *bv_to_string(bitvector bv, char *string, int size);
60 bitvector bv_new(int size); /* Create a new Bitvector for size Bits */
61 /* All bits are reset */
62 void bv_set_bit(bitvector bv, int bit); /* set Bit bit of bitvector */
63 void bv_reset_bit(bitvector bv, int bit); /* reset Bit bit of bitvector */
64 void bv_reset(bitvector bv, int size); /* reset the whole bitvector */
65 bool bv_is_empty(bitvector bv, int size); /* Returns if no Bit is set */
66 bool bv_get_bit(bitvector bv, int bit); /* Returns if Bit bit is set */
67 bool bv_equal(bitvector s1, bitvector s2, int size);
69 /* copy the whole bitvector */
71 void bv_copy(bitvector dst, bitvector src, int size);
75 void bv_minus(bitvector d, bitvector s1, bitvector s2, int size);
79 void bv_union(bitvector d, bitvector s1, bitvector s2, int size);
81 #endif /* _BITVECTOR_H */
85 * These are local overrides for various environment variables in Emacs.
86 * Please do not remove this and leave it at the end of the file, where
87 * Emacs will automagically detect them.
88 * ---------------------------------------------------------------------