Skip to content

Commit

Permalink
Fix sort and remove dup (#55)
Browse files Browse the repository at this point in the history
* Update binaryfusefilter.h

* Update xorfilter.h
  • Loading branch information
yangzq50 authored Feb 19, 2024
1 parent 7e2e6e7 commit 145adc2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/binaryfusefilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ static int binary_fuse_cmpfunc(const void * a, const void * b) {

static size_t binary_fuse_sort_and_remove_dup(uint64_t* keys, size_t length) {
qsort(keys, length, sizeof(uint64_t), binary_fuse_cmpfunc);
size_t j = 0;
size_t j = 1;
for(size_t i = 1; i < length; i++) {
if(keys[i] != keys[i-1]) {
keys[j] = keys[i];
j++;
}
}
return j+1;
return j;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions include/xorfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ static int xor_cmpfunc(const void * a, const void * b) {

static size_t xor_sort_and_remove_dup(uint64_t* keys, size_t length) {
qsort(keys, length, sizeof(uint64_t), xor_cmpfunc);
size_t j = 0;
size_t j = 1;
for(size_t i = 1; i < length; i++) {
if(keys[i] != keys[i-1]) {
keys[j] = keys[i];
j++;
}
}
return j+1;
return j;
}
/**
* We assume that you have a large set of 64-bit integers
Expand Down

0 comments on commit 145adc2

Please sign in to comment.