Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

bitset.h 810 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  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 */
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...