Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions fake_pyrex/Pyrex/.svn/all-wcprops

This file was deleted.

65 changes: 0 additions & 65 deletions fake_pyrex/Pyrex/.svn/entries

This file was deleted.

1 change: 0 additions & 1 deletion fake_pyrex/Pyrex/.svn/text-base/__init__.py.svn-base

This file was deleted.

17 changes: 0 additions & 17 deletions fake_pyrex/Pyrex/Distutils/.svn/all-wcprops

This file was deleted.

96 changes: 0 additions & 96 deletions fake_pyrex/Pyrex/Distutils/.svn/entries

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 6 additions & 0 deletions src/bloomfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ BloomFilter *bloomfilter_Create_Malloc(size_t max_num_elem, double error_rate,
bf->bf_version = BF_CURRENT_VERSION;
bf->elem_count = 0;
bf->array = NULL;
bf->elem_count_p = NULL;
memset(bf->reserved, 0, sizeof(uint32_t) * 32);
memset(bf->hash_seeds, 0, sizeof(uint32_t) * 256);
memcpy(bf->hash_seeds, hash_seeds, sizeof(uint32_t) * num_hashes);
Expand Down Expand Up @@ -57,6 +58,7 @@ BloomFilter *bloomfilter_Create_Mmap(size_t max_num_elem, double error_rate,
bf->bf_version = BF_CURRENT_VERSION;
bf->elem_count = 0;
bf->array = NULL;
bf->elem_count_p = NULL;
memset(bf->reserved, 0, sizeof(uint32_t) * 32);
memset(bf->hash_seeds, 0, sizeof(uint32_t) * 256);
memcpy(bf->hash_seeds, hash_seeds, sizeof(uint32_t) * num_hashes);
Expand All @@ -81,6 +83,10 @@ BloomFilter *bloomfilter_Create_Mmap(size_t max_num_elem, double error_rate,
/* Since we just initialized from a file, we have to
fix our pointers */
bf->array = array;

/* mmap address of bf->elem_count */
bf->elem_count_p = (uint64_t *) ((char *) bf->array->vector + MBAMAGICSIZE + sizeof (BTYPE) + sizeof (int32_t));


return bf;
}
Expand Down
5 changes: 4 additions & 1 deletion src/bloomfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
#define BF_CURRENT_VERSION 1

struct _BloomFilter {
unsigned char count_correct;
uint64_t * elem_count_p;
uint64_t max_num_elem;
double error_rate;
uint32_t num_hashes;
uint32_t hash_seeds[256];
/* All of the bit data is already in here. */
MBArray * array;
unsigned char bf_version;
unsigned char count_correct;
uint64_t elem_count;
uint32_t reserved[32];
};
Expand Down Expand Up @@ -68,6 +69,8 @@ static inline int bloomfilter_Add(BloomFilter * bf, Key * key)
}
if (!result && bf->count_correct) {
bf->elem_count ++;
if (bf->elem_count_p != NULL)
*(bf->elem_count_p) = bf->elem_count;
}
return result;
}
Expand Down