1 /***********************************************************
2 Copyright (c) 2000, BeOpen.com.
3 Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4 Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
7 See the file "Misc/COPYRIGHT" for information on usage and
8 redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9 ******************************************************************/
17 /* Bitset interface */
23 bitset
newbitset(int nbits
);
24 void delbitset(bitset bs
);
25 #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
26 int addbit(bitset bs
, int ibit
); /* Returns 0 if already set */
27 int samebitset(bitset bs1
, bitset bs2
, int nbits
);
28 void mergebitset(bitset bs1
, bitset bs2
, int nbits
);
30 #define BITSPERBYTE (8*sizeof(BYTE))
31 #define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
33 #define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE)
34 #define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)
35 #define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit))
36 #define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE)
41 #endif /* !Py_BITSET_H */