blob: 6a2ac9787eaba30743b053e405c90e09a6308516 [file] [log] [blame]
Olivier Deprezf4ef2d02021-04-20 13:36:24 +02001
2#ifndef Py_BITSET_H
3#define Py_BITSET_H
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/* Bitset interface */
9
10#define BYTE char
11typedef BYTE *bitset;
12
13#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
14
15#define BITSPERBYTE (8*sizeof(BYTE))
16#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE)
17#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)
18#define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit))
19
20#ifdef __cplusplus
21}
22#endif
23#endif /* !Py_BITSET_H */