You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
657 B
26 lines
657 B
from libc.stdint cimport uint64_t, uint32_t
|
|
from cymem.cymem cimport Pool
|
|
|
|
ctypedef uint64_t key_t
|
|
|
|
cdef struct BloomStruct:
|
|
key_t* bitfield
|
|
key_t hcount # hash count, number of hash functions
|
|
key_t length
|
|
uint32_t seed
|
|
|
|
|
|
cdef class BloomFilter:
|
|
cdef Pool mem
|
|
cdef BloomStruct* c_bloom
|
|
cdef inline bint contains(self, key_t item) nogil
|
|
|
|
|
|
cdef void bloom_init(Pool mem, BloomStruct* bloom, key_t hcount, key_t length, uint32_t seed) except *
|
|
|
|
cdef void bloom_add(BloomStruct* bloom, key_t item) nogil
|
|
|
|
cdef bint bloom_contains(const BloomStruct* bloom, key_t item) nogil
|
|
|
|
cdef void bloom_add(BloomStruct* bloom, key_t item) nogil
|