Skip to content

Commit bcf5324

Browse files
committed
Switch bitvector to 64-bit words and default allocator
1 parent fe3452e commit bcf5324

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bitvector.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <simde/x86/avx512.h>
1717
namespace bowen
1818
{
19-
template<typename T,unsigned int ALIGN_SIZE=32>
19+
template<typename T, unsigned int ALIGN_SIZE = 32>
2020
class MMAllocator {
2121
public:
2222
typedef T value_type;
@@ -42,7 +42,7 @@ namespace bowen
4242
}
4343
};
4444

45-
typedef uint32_t BitType;
45+
typedef unsigned long BitType;
4646
const int WORD_BITS = static_cast<int>(sizeof(BitType) * 8);
4747
constexpr int compute_shift(int bits) {
4848
int shift = 0;
@@ -55,7 +55,7 @@ namespace bowen
5555
static constexpr int WORD_SHIFT = compute_shift(WORD_BITS);
5656
static_assert((1u << WORD_SHIFT) == WORD_BITS,
5757
"WORD_BITS must be a power of two for fast indexing");
58-
template<typename Allocator = MMAllocator<BitType>>
58+
template<typename Allocator = std::allocator<BitType>>
5959
class BitReference
6060
{
6161
private:
@@ -90,7 +90,7 @@ namespace bowen
9090
*m_ptr ^= m_mask;
9191
}
9292
};
93-
template<typename Allocator = MMAllocator<BitType>>
93+
template<typename Allocator = std::allocator<BitType>>
9494
class BitIterator {
9595
using iterator_category = std::random_access_iterator_tag;
9696
using value_type = bool;
@@ -140,7 +140,7 @@ namespace bowen
140140
return !(*this == other);
141141
}
142142
};
143-
template<typename Allocator = MMAllocator<BitType>>
143+
template<typename Allocator = std::allocator<BitType>>
144144
class bitvector
145145
{
146146
private:
@@ -336,7 +336,7 @@ namespace bowen
336336
}
337337
while(pos < m_size-WORD_BITS&& (*this)[pos] != 0){
338338
BitType num = m_data[pos / WORD_BITS];
339-
int oneCounts = _tzcnt_u32(~num);
339+
int oneCounts = _tzcnt_u64(~num);
340340
if(oneCounts == WORD_BITS){
341341
pos+= oneCounts;
342342
}else{

0 commit comments

Comments
 (0)