|
@ -11,7 +11,7 @@ |
|
|
namespace gp { |
|
|
namespace gp { |
|
|
template<typename hash_type = uint64_t, uint8_t magnitude = 19, bool threading = false> |
|
|
template<typename hash_type = uint64_t, uint8_t magnitude = 19, bool threading = false> |
|
|
class bloomfilter { |
|
|
class bloomfilter { |
|
|
constexpr static size_t phys_size = (1 << magnitude) / 32; |
|
|
|
|
|
|
|
|
constexpr static size_t phys_size = (1ull << magnitude) / 32ull; |
|
|
gp::array< |
|
|
gp::array< |
|
|
typename gp::either< threading, |
|
|
typename gp::either< threading, |
|
|
std::atomic_uint32_t, |
|
|
std::atomic_uint32_t, |
|
@ -22,12 +22,12 @@ namespace gp { |
|
|
|
|
|
|
|
|
template<typename T> |
|
|
template<typename T> |
|
|
static void set_bit(T* value, const int v_pos) { |
|
|
static void set_bit(T* value, const int v_pos) { |
|
|
*value |= (1 << v_pos); |
|
|
|
|
|
|
|
|
*value |= (1ull << v_pos); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> |
|
|
template<typename T> |
|
|
static bool get_bit(T* value, const int v_pos) { |
|
|
static bool get_bit(T* value, const int v_pos) { |
|
|
return (*value >> v_pos) & 1; |
|
|
|
|
|
|
|
|
return (*value >> v_pos) & 1ull; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public: |
|
|
public: |
|
@ -38,7 +38,7 @@ namespace gp { |
|
|
|
|
|
|
|
|
void set_hash(hash_type v) |
|
|
void set_hash(hash_type v) |
|
|
{ |
|
|
{ |
|
|
const size_t modulo = v & ((1 << magnitude)-1); |
|
|
|
|
|
|
|
|
const size_t modulo = v & ((1ull << magnitude)-1ull); |
|
|
const size_t p_pos = modulo / 32; |
|
|
const size_t p_pos = modulo / 32; |
|
|
const size_t v_pos = modulo % 32; |
|
|
const size_t v_pos = modulo % 32; |
|
|
|
|
|
|
|
@ -47,7 +47,7 @@ namespace gp { |
|
|
|
|
|
|
|
|
bool test_hash(hash_type v) |
|
|
bool test_hash(hash_type v) |
|
|
{ |
|
|
{ |
|
|
const size_t modulo = v & ((1 << magnitude)-1); |
|
|
|
|
|
|
|
|
const size_t modulo = v & ((1ull << magnitude)-1ull); |
|
|
const size_t p_pos = modulo / 32; |
|
|
const size_t p_pos = modulo / 32; |
|
|
const size_t v_pos = modulo % 32; |
|
|
const size_t v_pos = modulo % 32; |
|
|
|
|
|
|
|
|