Skip to content

Commit 7279984

Browse files
committed
Various minor fixes
1 parent b0fd992 commit 7279984

9 files changed

+24
-35
lines changed

src/gcs/gcs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,9 @@ Status GcsFilter<ItemType, bits_per_item, HashFamily>::AddAll(
305305
qsort(data, len, sizeof(uint64_t), compare_uint64);
306306
size_t bucketslen = 10L * fingerprintBits * len / 64;
307307
uint64_t* buckets = new uint64_t[bucketslen];
308-
memset(buckets, 0, sizeof(uint64_t[bucketslen]));
308+
memset(buckets, 0, sizeof(uint64_t) * bucketslen);
309309
uint32_t* startList = new uint32_t[bucketCount + 1];
310-
memset(startList, 0, sizeof(uint32_t[bucketCount + 1]));
310+
memset(startList, 0, sizeof(uint32_t) * (bucketCount + 1));
311311
int bucket = 0;
312312
long last = 0;
313313
int pos = 0;

src/morton/compressed_cuckoo_filter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ namespace CompressedCuckoo{
11691169
else if(!_morton_filter_functionality_enabled){
11701170
hash_t secondary_bucket = determine_alternate_bucket(primary_bucket,
11711171
fingerprint);
1172-
return table_read_and_compare(primary_bucket, fingerprint) |
1172+
return table_read_and_compare(primary_bucket, fingerprint) ||
11731173
table_read_and_compare(secondary_bucket, fingerprint);
11741174
}
11751175

@@ -1622,7 +1622,7 @@ namespace CompressedCuckoo{
16221622
switch(_insertion_method){
16231623
case InsertionMethodEnum::FIRST_FIT_OPT:
16241624
try_first_block_insert[i] = (elements_in_blocks_1[i] !=
1625-
_max_fingerprints_per_block) | (elements_in_blocks_2[i] ==
1625+
_max_fingerprints_per_block) || (elements_in_blocks_2[i] ==
16261626
_max_fingerprints_per_block);
16271627
break;
16281628
default: // HYBRID_PIECEWISE, TWO_CHOICE
@@ -1723,7 +1723,7 @@ namespace CompressedCuckoo{
17231723
for(uint32_t i = 0; i < batch_size; i++){
17241724
counter_values[i] = read_counter(block_ids[i], counter_indexes[i]);
17251725
statuses[offset + i] = !((elements_in_blocks[i] ==
1726-
_max_fingerprints_per_block) | (counter_values[i] == _slots_per_bucket));
1726+
_max_fingerprints_per_block) || (counter_values[i] == _slots_per_bucket));
17271727

17281728
if(statuses[offset + i]){
17291729
write_fingerprint_left_displace(_storage[block_ids[i]],

src/xorfilter/3wise_xor_binary_fuse_filter_lowmem.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ Status XorBinaryFuseFilter<ItemType, FingerprintType, HashFamily>::AddAll(
133133
size_t h012[5];
134134

135135
while (true) {
136-
memset(t2count, 0, sizeof(uint8_t[arrayLength]));
137-
memset(t2hash, 0, sizeof(uint64_t[arrayLength]));
136+
memset(t2count, 0, sizeof(uint8_t) * arrayLength);
137+
memset(t2hash, 0, sizeof(uint64_t) * arrayLength);
138138

139139
// counting sort
140140

141-
memset(reverseOrder, 0, sizeof(uint64_t[size]));
141+
memset(reverseOrder, 0, sizeof(uint64_t) * size);
142142
reverseOrder[size] = 1;
143143

144144
int blockBits = 1;

src/xorfilter/3wise_xor_binary_fuse_filter_naive.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ Status XorBinaryFuseFilter<ItemType, FingerprintType, HashFamily>::AddAll(
124124
t2val_t *t2vals = new t2val_t[arrayLength];
125125

126126
size_t *alone = new size_t[arrayLength];
127-
size_t hashIndex{0};
128127

129128
while (true) {
130129
memset(t2vals, 0, sizeof(t2val_t[arrayLength]));
@@ -170,7 +169,6 @@ Status XorBinaryFuseFilter<ItemType, FingerprintType, HashFamily>::AddAll(
170169
if (reverseOrderPos == size) {
171170
break;
172171
}
173-
hashIndex++;
174172
// use a new random numbers
175173
delete hasher;
176174
hasher = new HashFamily();

src/xorfilter/4wise_xor_binary_fuse_filter_lowmem.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ Status XorBinaryFuseFilter<ItemType, FingerprintType, HashFamily>::AddAll(
148148
hi0123[6] = 2;
149149

150150
while (true) {
151-
memset(t2count, 0, sizeof(uint8_t[arrayLength]));
152-
memset(t2hash, 0, sizeof(uint64_t[arrayLength]));
151+
memset(t2count, 0, sizeof(uint8_t) * arrayLength);
152+
memset(t2hash, 0, sizeof(uint64_t) * arrayLength);
153153

154154
// counting sort
155155

156-
memset(reverseOrder, 0, sizeof(uint64_t[size]));
156+
memset(reverseOrder, 0, sizeof(uint64_t) * size);
157157
reverseOrder[size] = 1;
158158

159159
int blockBits = 1;

src/xorfilter/4wise_xor_binary_fuse_filter_naive.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ Status XorBinaryFuseFilter<ItemType, FingerprintType, HashFamily>::AddAll(
129129
t2val_t *t2vals = new t2val_t[arrayLength];
130130

131131
size_t *alone = new size_t[arrayLength];
132-
size_t hashIndex{0};
133132

134133
while (true) {
135134
memset(t2vals, 0, sizeof(t2val_t[arrayLength]));
@@ -175,7 +174,6 @@ Status XorBinaryFuseFilter<ItemType, FingerprintType, HashFamily>::AddAll(
175174
if (reverseOrderPos == size) {
176175
break;
177176
}
178-
hashIndex++;
179177
// use a new random numbers
180178
delete hasher;
181179
hasher = new HashFamily();

src/xorfilter/binaryfusefilter_singleheader.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ static inline bool binary_fuse8_populate(const uint64_t *keys, uint32_t size,
295295
error = (t2count[h2] < 4) ? 1 : error;
296296
}
297297
if(error) {
298-
memset(reverseOrder, 0, sizeof(uint64_t[size]));
299-
memset(t2count, 0, sizeof(uint8_t[capacity]));
300-
memset(t2hash, 0, sizeof(uint64_t[capacity]));
298+
memset(reverseOrder, 0, sizeof(uint64_t) * size);
299+
memset(t2count, 0, sizeof(uint8_t) * capacity);
300+
memset(t2hash, 0, sizeof(uint64_t) * capacity);
301301
filter->Seed = binary_fuse_rng_splitmix64(&rng_counter);
302302
continue;
303303
}
@@ -346,9 +346,9 @@ static inline bool binary_fuse8_populate(const uint64_t *keys, uint32_t size,
346346
size = stacksize;
347347
break;
348348
}
349-
memset(reverseOrder, 0, sizeof(uint64_t[size]));
350-
memset(t2count, 0, sizeof(uint8_t[capacity]));
351-
memset(t2hash, 0, sizeof(uint64_t[capacity]));
349+
memset(reverseOrder, 0, sizeof(uint64_t) * size);
350+
memset(t2count, 0, sizeof(uint8_t) * capacity);
351+
memset(t2hash, 0, sizeof(uint64_t) * capacity);
352352
filter->Seed = binary_fuse_rng_splitmix64(&rng_counter);
353353
}
354354

@@ -579,9 +579,9 @@ static inline bool binary_fuse16_populate(const uint64_t *keys, uint32_t size,
579579
error = (t2count[h2] < 4) ? 1 : error;
580580
}
581581
if(error) {
582-
memset(reverseOrder, 0, sizeof(uint64_t[size]));
583-
memset(t2count, 0, sizeof(uint8_t[capacity]));
584-
memset(t2hash, 0, sizeof(uint64_t[capacity]));
582+
memset(reverseOrder, 0, sizeof(uint64_t) * size);
583+
memset(t2count, 0, sizeof(uint8_t) * capacity);
584+
memset(t2hash, 0, sizeof(uint64_t) * capacity);
585585
filter->Seed = binary_fuse_rng_splitmix64(&rng_counter);
586586
continue;
587587
}
@@ -630,9 +630,9 @@ static inline bool binary_fuse16_populate(const uint64_t *keys, uint32_t size,
630630
size = stacksize;
631631
break;
632632
}
633-
memset(reverseOrder, 0, sizeof(uint64_t[size]));
634-
memset(t2count, 0, sizeof(uint8_t[capacity]));
635-
memset(t2hash, 0, sizeof(uint64_t[capacity]));
633+
memset(reverseOrder, 0, sizeof(uint64_t) * size);
634+
memset(t2count, 0, sizeof(uint8_t) * capacity);
635+
memset(t2hash, 0, sizeof(uint64_t) * capacity);
636636
filter->Seed = binary_fuse_rng_splitmix64(&rng_counter);
637637
}
638638

src/xorfilter/xorfilter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ Status XorFilter<ItemType, FingerprintType, HashFamily>::AddAll(
385385
uint64_t* reverseOrder = new uint64_t[size];
386386
uint8_t* reverseH = new uint8_t[size];
387387
size_t reverseOrderPos;
388-
int hashIndex = 0;
389388
t2val_t * t2vals = new t2val_t[m];
390389
size_t* alone = new size_t[arrayLength];
391390
while (true) {
@@ -430,7 +429,6 @@ Status XorFilter<ItemType, FingerprintType, HashFamily>::AddAll(
430429
if (reverseOrderPos == size) {
431430
break;
432431
}
433-
hashIndex++;
434432
// use a new random numbers
435433
delete hasher;
436434
hasher = new HashFamily();

src/xorfilter/xorfilter_plus.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Rank9 {
5252
countsArraySize = numCounts + 1;
5353
counts = new uint64_t[countsArraySize];
5454
// just to be sure
55-
memset(counts, 0, sizeof(uint64_t[countsArraySize]));
55+
memset(counts, 0, sizeof(uint64_t) * countsArraySize);
5656
uint64_t c = 0;
5757
uint64_t pos = 0;
5858
for (uint64_t i = 0; i < numWords; i += 8, pos += 2) {
@@ -220,7 +220,6 @@ Status XorFilterPlus<ItemType, FingerprintType, HashFamily>::AddAll(
220220
uint64_t* reverseOrder = new uint64_t[size];
221221
uint8_t* reverseH = new uint8_t[size];
222222
size_t reverseOrderPos;
223-
int hashIndex = 0;
224223
t2val_t * t2vals = new t2val_t[m];
225224
while (true) {
226225
memset(t2vals, 0, sizeof(t2val_t[m]));
@@ -304,10 +303,6 @@ Status XorFilterPlus<ItemType, FingerprintType, HashFamily>::AddAll(
304303
if (reverseOrderPos == size) {
305304
break;
306305
}
307-
308-
309-
hashIndex++;
310-
311306
// use a new random numbers
312307
delete hasher;
313308
hasher = new HashFamily();

0 commit comments

Comments
 (0)