Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
792 B

  1. #ifndef Py_BITSET_H
  2. #define Py_BITSET_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* Bitset interface */
  7. #define BYTE char
  8. typedef BYTE *bitset;
  9. bitset newbitset(int nbits);
  10. void delbitset(bitset bs);
  11. #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
  12. int addbit(bitset bs, int ibit); /* Returns 0 if already set */
  13. int samebitset(bitset bs1, bitset bs2, int nbits);
  14. void mergebitset(bitset bs1, bitset bs2, int nbits);
  15. #define BITSPERBYTE (8*sizeof(BYTE))
  16. #define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
  17. #define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE)
  18. #define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)
  19. #define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit))
  20. #define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE)
  21. #ifdef __cplusplus
  22. }
  23. #endif
  24. #endif /* !Py_BITSET_H */