Пример #1
0
int counting_bloom_add_with_hash(counting_bloom_t *bloom, unsigned int *hashes)
{
    unsigned int index, i, offset;

    for (i = 0; i < bloom->nfuncs; i++) {
        offset = i * bloom->counts_per_func;
        index = hashes[i] + offset;
        bitmap_increment(bloom->bitmap, index, bloom->offset);
    }
    __sync_fetch_and_add(&(bloom->header->count), 1);
    //bloom->header->count++;

    return 0;
}
Пример #2
0
int counting_bloom_add(counting_bloom_t *bloom, const char *s, size_t len)
{
	unsigned int index, i, offset;
	unsigned int *hashes = bloom->hashes;

	hash_func(bloom, s, len, hashes);

	for (i = 0; i < bloom->nfuncs; i++) {
		offset = i * bloom->counts_per_func;
		index = hashes[i] + offset;
		bitmap_increment(bloom->bitmap, index, bloom->offset);
	}
	bloom->header->count++;

	return 0;
}