PR149: Used wrong class loader.
[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 #include "vm/global.h"
37
38 #if !defined(NDEBUG)
39 #include <assert.h>
40
41 /* define BV_DEBUG_CHECK to activate the bound checks */
42
43 /* #define BV_DEBUG_CHECK */
44
45 /* no debug messages implemented till now */
46
47 /* #define BV_DEBUG_VERBOSE */
48 #endif
49
50 #if defined(BV_DEBUG_CHECK)
51 #define _BV_CHECK_BOUNDS(i,l,h) assert( ((i) >= (l)) && ((i) < (h)));
52 #define _BV_ASSERT(a) assert((a));
53 #else
54 #define _BV_CHECK_BOUNDS(i,l,h);
55 #define _BV_ASSERT(a);
56 #endif
57 typedef int *bitvector;
58
59 /* function prototypes */
60 char *bv_to_string(bitvector bv, char *string, int size);
61 bitvector bv_new(int size);           /* Create a new Bitvector for size Bits */
62                                       /* All bits are reset                   */
63 void bv_set_bit(bitvector bv, int bit);    /* set Bit bit of bitvector       */
64 void bv_reset_bit(bitvector bv, int bit);  /* reset Bit bit of bitvector     */
65 void bv_reset(bitvector bv, int size);     /* reset the whole bitvector      */
66 bool bv_is_empty(bitvector bv, int size);  /* Returns if no Bit is set       */
67 bool bv_get_bit(bitvector bv, int bit);    /* Returns if Bit bit is set      */
68 bool bv_equal(bitvector s1, bitvector s2, int size);
69
70 /* copy the whole bitvector    */
71
72 void bv_copy(bitvector dst, bitvector src, int size); 
73
74 /* d = s1 \ s2     */
75
76 void bv_minus(bitvector d, bitvector s1, bitvector s2, int size);
77
78 /* d = s1 union s2 */
79
80 void bv_union(bitvector d, bitvector s1, bitvector s2, int size);
81
82 #endif /* _BITVECTOR_H */
83
84
85 /*
86  * These are local overrides for various environment variables in Emacs.
87  * Please do not remove this and leave it at the end of the file, where
88  * Emacs will automagically detect them.
89  * ---------------------------------------------------------------------
90  * Local variables:
91  * mode: c
92  * indent-tabs-mode: t
93  * c-basic-offset: 4
94  * tab-width: 4
95  * End:
96  */