浏览代码

Made most bloomfilter constants ULL

master
Ludovic 'Archivist' Lagouardette 3 年前
父节点
当前提交
682989d5e1
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. +5
    -5
      include/gp/containers/probabilistic/bloomfilter.hpp

+ 5
- 5
include/gp/containers/probabilistic/bloomfilter.hpp 查看文件

@ -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;

正在加载...
取消
保存