Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 1 | |
| 2 | #ifndef Py_BITSET_H |
| 3 | #define Py_BITSET_H |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
| 8 | /* Bitset interface */ |
| 9 | |
| 10 | #define BYTE char |
| 11 | typedef 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 */ |