Updated header
[libfirm] / ir / st / bs.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /*
21  * Project:     libFIRM
22  * File name:   ir/st/bs.h
23  * Purpose:     Provides a simple bit set.
24  * Author:      Florian Liekweg
25  * Modified by:
26  * Created:     4.3.2002
27  * CVS-ID:      $Id$
28  * Copyright:   (c) 2002-2003 Universität Karlsruhe
29  */
30
31 /**
32    @file bs.h
33
34    Provides a simple bit set.
35
36    Not quite complete
37 */
38
39
40 # ifndef _BS_H_
41 # define _BS_H_
42
43 /**
44  * the type of a bit set
45  */
46 typedef long int bs_t;
47
48 /** set bit in a bit set */
49 # define bs_set(bs, i) (bs) |= (0x00000001 << i)
50
51 /** get bit in a bit set */
52 # define bs_get(bs, i) (bs) &  (0x00000001 << i)
53
54 /** logical AND of two bit sets */
55 # define bs_and(bsa, bsb) (bsa) &= (bsb)
56
57 /** logical OR of two bit sets */
58 # define bs_or(bsa, bsb)  (bsa) |= (bsb)
59
60 /** logical XOR of two bit sets */
61 # define bs_xor(bsa, bsb) (bsa) ^= (bsb)
62
63 /** returns TRUE if at least one bit is set */
64 # define bs_zro(bs) (0x00000000 != bs)
65
66 # endif /* ndef _BS_H_ */