Browse Source

Made most bloomfilter constants ULL

master
Ludovic 'Archivist' Lagouardette 3 years ago
parent
commit
682989d5e1
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      include/gp/containers/probabilistic/bloomfilter.hpp

+ 5
- 5
include/gp/containers/probabilistic/bloomfilter.hpp View File

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

Loading…
Cancel
Save