- Added raw_bitset.h it contains routines for handling "raw" bitsets, which are
[libfirm] / ir / st / bs.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/st/bs.h
4  * Purpose:     Provides a simple bit set.
5  * Author:      Florian Liekweg
6  * Modified by:
7  * Created:     4.3.2002
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2002-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14    @file bs.h
15
16    Provides a simple bit set.
17
18    Not quite complete
19 */
20
21
22 # ifndef _BS_H_
23 # define _BS_H_
24
25 /**
26  * the type of a bit set
27  */
28 typedef long int bs_t;
29
30 /** set bit in a bit set */
31 # define bs_set(bs, i) (bs) |= (0x00000001 << i)
32
33 /** get bit in a bit set */
34 # define bs_get(bs, i) (bs) &  (0x00000001 << i)
35
36 /** logical AND of two bit sets */
37 # define bs_and(bsa, bsb) (bsa) &= (bsb)
38
39 /** logical OR of two bit sets */
40 # define bs_or(bsa, bsb)  (bsa) |= (bsb)
41
42 /** logical XOR of two bit sets */
43 # define bs_xor(bsa, bsb) (bsa) ^= (bsb)
44
45 /** returns TRUE if at least one bit is set */
46 # define bs_zro(bs) (0x00000000 != bs)
47
48 # endif /* ndef _BS_H_ */