15 bit_count_(bit_count),
16 rank_((bit_count_+511)/512 + 1){
21 for(uint64_t j = 0; j<
rank_.size()-1; ++j){
24 s0 = __builtin_popcountll(
bits_[i+0]),
25 s1 = __builtin_popcountll(
bits_[i+1]),
26 s2 = __builtin_popcountll(
bits_[i+2]),
27 s3 = __builtin_popcountll(
bits_[i+3]),
28 s4 = __builtin_popcountll(
bits_[i+4]),
29 s5 = __builtin_popcountll(
bits_[i+5]),
30 s6 = __builtin_popcountll(
bits_[i+6]),
31 s7 = __builtin_popcountll(
bits_[i+7]);
35 s0 += s4; s1 += s5; s2 += s6; s3 += s7;
64 uint8_t uint64_offset = global_id % 64;
65 uint64_t uint64_index = global_id / 64;
68 if(__builtin_expect((
bits_[uint64_index] & (1ull<<uint64_offset))==0,
true)){
72 uint64_t uint512_index = global_id / 512;
74 uint64_t local_id =
rank_[uint512_index];
76 for(uint64_t i=uint512_index*8; i<uint64_index; ++i)
77 local_id += __builtin_popcountll(
bits_[i]);
79 local_id += __builtin_popcountll(
bits_[uint64_index] & ((1ull<<uint64_offset)-1));
89 uint8_t uint64_offset = global_id % 64;
90 uint64_t uint64_index = global_id / 64;
92 assert((
bits_[uint64_index] & (1ull<<uint64_offset))!=0 &&
"global id is not mapped");
94 uint64_t uint512_index = global_id / 512;
96 uint64_t local_id =
rank_[uint512_index];
98 for(uint64_t i=uint512_index*8; i<uint64_index; ++i)
99 local_id += __builtin_popcountll(
bits_[i]);
101 local_id += __builtin_popcountll(
bits_[uint64_index] & ((1ull<<uint64_offset)-1));