@@ -25,31 +25,31 @@ namespace gtl {
25
25
26
26
namespace bitv {
27
27
28
- static constexpr size_t stride = 64 ;
29
- static constexpr uint64_t ones = (uint64_t )-1 ;
28
+ inline constexpr size_t stride = 64 ;
29
+ inline constexpr uint64_t ones = (uint64_t )-1 ;
30
30
31
- static constexpr size_t mod (size_t n) { return (n & 0x3f ); }
32
- static constexpr size_t slot (size_t n) { return n >> 6 ; }
33
- static constexpr size_t slot_cnt (size_t n) { return slot (n + 63 ); }
31
+ inline constexpr size_t mod (size_t n) { return (n & 0x3f ); }
32
+ inline constexpr size_t slot (size_t n) { return n >> 6 ; }
33
+ inline constexpr size_t slot_cnt (size_t n) { return slot (n + 63 ); }
34
34
35
35
// a mask for this bit in its slot
36
- static constexpr uint64_t bitmask (size_t n) { return (uint64_t )1 << mod (n); }
36
+ inline constexpr uint64_t bitmask (size_t n) { return (uint64_t )1 << mod (n); }
37
37
38
38
// a mask for bits lower than n in slot
39
- static constexpr uint64_t lowmask (size_t n) { return bitmask (n) - 1 ; }
39
+ inline constexpr uint64_t lowmask (size_t n) { return bitmask (n) - 1 ; }
40
40
41
41
// a mask for bits higher than n-1 in slot
42
- static constexpr uint64_t himask (size_t n) { return ~lowmask (n); }
42
+ inline constexpr uint64_t himask (size_t n) { return ~lowmask (n); }
43
43
44
- static constexpr size_t _popcount64 (uint64_t y) {
44
+ inline constexpr size_t _popcount64 (uint64_t y) {
45
45
// https://gist.github.com/enjoylife/4091854
46
46
y -= ((y >> 1 ) & 0x5555555555555555ull );
47
47
y = (y & 0x3333333333333333ull ) + (y >> 2 & 0x3333333333333333ull );
48
48
return ((y + (y >> 4 )) & 0xf0f0f0f0f0f0f0full ) * 0x101010101010101ull >> 56 ;
49
49
}
50
50
51
51
// De Bruijn Multiplication With separated LS1B - author Kim Walisch (2012)
52
- unsigned countr_zero (uint64_t bb) {
52
+ inline constexpr unsigned countr_zero (uint64_t bb) {
53
53
const unsigned index64[64 ] = { 0 , 47 , 1 , 56 , 48 , 27 , 2 , 60 , 57 , 49 , 41 , 37 , 28 , 16 , 3 , 61 ,
54
54
54 , 58 , 35 , 52 , 50 , 42 , 21 , 44 , 38 , 32 , 29 , 23 , 17 , 11 , 4 , 62 ,
55
55
46 , 55 , 26 , 59 , 40 , 36 , 15 , 53 , 34 , 51 , 20 , 43 , 31 , 22 , 10 , 45 ,
0 commit comments