Skip to content

Commit 145adc2

Browse files
authored
Fix sort and remove dup (#55)
* Update binaryfusefilter.h * Update xorfilter.h
1 parent 7e2e6e7 commit 145adc2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/binaryfusefilter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ static int binary_fuse_cmpfunc(const void * a, const void * b) {
1919

2020
static size_t binary_fuse_sort_and_remove_dup(uint64_t* keys, size_t length) {
2121
qsort(keys, length, sizeof(uint64_t), binary_fuse_cmpfunc);
22-
size_t j = 0;
22+
size_t j = 1;
2323
for(size_t i = 1; i < length; i++) {
2424
if(keys[i] != keys[i-1]) {
2525
keys[j] = keys[i];
2626
j++;
2727
}
2828
}
29-
return j+1;
29+
return j;
3030
}
3131

3232
/**

include/xorfilter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ static int xor_cmpfunc(const void * a, const void * b) {
2222

2323
static size_t xor_sort_and_remove_dup(uint64_t* keys, size_t length) {
2424
qsort(keys, length, sizeof(uint64_t), xor_cmpfunc);
25-
size_t j = 0;
25+
size_t j = 1;
2626
for(size_t i = 1; i < length; i++) {
2727
if(keys[i] != keys[i-1]) {
2828
keys[j] = keys[i];
2929
j++;
3030
}
3131
}
32-
return j+1;
32+
return j;
3333
}
3434
/**
3535
* We assume that you have a large set of 64-bit integers

0 commit comments

Comments
 (0)