eĿlipsis
a language independent preprocessor
 
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Loading...
Searching...
No Matches
ellipsis-bitset.h
Go to the documentation of this file.
1
7#ifndef ELLIPSIS_BITSET_H
8#define ELLIPSIS_BITSET_H 1
9
10#include <limits.h>
11#include <stddef.h>
12#include <inttypes.h>
13
14typedef uint64_t ellipsis‿bitset‿base;
15enum {
17};
18
19inline
23
24inline
25void ellipsis‿bitset‿insert(size_t tabsize, ellipsis‿bitset‿base table[tabsize], size_t val) {
26 register size_t tpos = val / ellipsis‿bitset‿bits;
27 if (tpos < tabsize) {
28 register size_t bpos = val % ellipsis‿bitset‿bits;
29 table[tpos] |= ellipsis‿bitset‿baseset(bpos);
30 }
31}
32
33#define ellipsis_bitset_insert(A, V) ellipsis_bitset_insert(sizeof(A)/sizeof(A[0]), A, V)
34
35inline
36bool ellipsis‿bitset‿member(size_t tabsize, ellipsis‿bitset‿base table[tabsize], size_t val) {
37 register bool ret = false;
38 register size_t tpos = val / ellipsis‿bitset‿bits;
39 if (tpos < tabsize) {
40 register size_t bpos = val % ellipsis‿bitset‿bits;
41 ret = table[tpos] & ellipsis‿bitset‿baseset(bpos);
42 }
43 return ret;
44}
45
46#define ellipsis_bitset_member(A, V) ellipsis‿bitset‿member(sizeof(A)/sizeof(A[0]), A, V)
47
48#endif
bool ellipsis‿bitset‿member(size_t tabsize, ellipsis‿bitset‿base table[tabsize], size_t val)
Definition ellipsis-bitset.h:36
@ ellipsis‿bitset‿bits
Definition ellipsis-bitset.h:16
ellipsis‿bitset‿base ellipsis‿bitset‿baseset(size_t bval)
Definition ellipsis-bitset.h:20
void ellipsis‿bitset‿insert(size_t tabsize, ellipsis‿bitset‿base table[tabsize], size_t val)
Definition ellipsis-bitset.h:25
uint64_t ellipsis‿bitset‿base
Definition ellipsis-bitset.h:14