Debian Codegraph @

easel/esl_bitfield.h

raw symbols SCIP
1 #ifndef eslBITFIELD_INCLUDED
2 #define eslBITFIELD_INCLUDED
3 #include <esl_config.h>
4
5 #include "easel.h"
6
7 typedef struct {
8 uint64_t *b; // packed storage of flags
9 int nb; // number of flags
10 } ESL_BITFIELD;
11
12 static inline void
13 esl_bitfield_Set(ESL_BITFIELD *b, int i)
14 {
15 b->b[i/64] |= (1ull << (i%64));
16 }
17
18 static inline void
19 esl_bitfield_Clear(ESL_BITFIELD *b, int i)
20 {
21 b->b[i/64] &= ~(1ull << (i%64));
22 }
23
24 static inline void
25 esl_bitfield_Toggle(ESL_BITFIELD *b, int i)
26 {
27 b->b[i/64] ^= (1ull << (i%64));
28 }
29
30 static inline int
31 esl_bitfield_IsSet(const ESL_BITFIELD *b, int i)
32 {
33 return ((b->b[i/64] & (1ull << (i%64))) ? TRUE : FALSE);
34 }
35
36
37 extern ESL_BITFIELD *esl_bitfield_Create (int nb);
38 extern int esl_bitfield_Count (const ESL_BITFIELD *b);
39 extern void esl_bitfield_Destroy(ESL_BITFIELD *b);
40
41 #endif //eslBITFIELD_INCLUDED
42
43
44