@@ -176,55 +176,13 @@ int main(int argc, char **argv) {
176176 return EXIT_FAILURE;
177177 }
178178 xor8_free (&filter);
179- } else if (strcmp (" oldxor8" , filtername) == 0 ) {
180- start = clock ();
181- using Table = xorfilter::XorFilter<uint64_t , uint8_t , SimpleMixSplit>;
182- Table table (array_size);
183- table.AddAll (array, 0 , array_size);
184- end = clock ();
185- printf (" Done in %.3f seconds.\n " , (float )(end - start) / CLOCKS_PER_SEC);
186- if (verify) {
187- printf (" Checking for false negatives\n " );
188- for (size_t i = 0 ; i < array_size; i++) {
189- if (table.Contain (array[i]) != xorfilter::Ok) {
190- printf (" Detected a false negative. You probably have a bug. Aborting.\n " );
191- return EXIT_FAILURE;
192- }
193- }
194- printf (" Verified with success: no false negatives\n " );
195- }
196- free (array);
197-
198- FILE *write_ptr;
199- write_ptr = fopen (outputfilename, " wb" );
200- if (write_ptr == NULL ) {
201- printf (" Cannot write to the output file %s." , outputfilename);
202- return EXIT_FAILURE;
203- }
204- uint64_t cookie = 1234567 ;
205- uint64_t seed = table.hasher ->seed ;
206- uint64_t BlockLength = table.blockLength ;
207- bool isok = true ;
208- size_t total_bytes = sizeof (cookie) + sizeof (seed) + sizeof (BlockLength) +
209- sizeof (uint8_t ) * 3 * BlockLength;
210- isok &= fwrite (&cookie, sizeof (cookie), 1 , write_ptr);
211- isok &= fwrite (&seed, sizeof (seed), 1 , write_ptr);
212- isok &= fwrite (&BlockLength, sizeof (BlockLength), 1 , write_ptr);
213- isok &= fwrite (table.fingerprints , sizeof (uint8_t ) * 3 * BlockLength, 1 ,
214- write_ptr);
215- isok &= (fclose (write_ptr) == 0 );
216- if (isok) {
217- printf (" filter data saved to %s. Total bytes = %zu. \n " , outputfilename,
218- total_bytes);
219- } else {
220- printf (" failed to write filter data to %s.\n " , outputfilename);
221- return EXIT_FAILURE;
222- }
223- } else if (strcmp (" bloom12" , filtername) == 0 ) {
179+ } else if (strcmp (" bloom12" , filtername) == 0 ) {
224180 start = clock ();
225181 using Table = bloomfilter::BloomFilter<uint64_t , 12 , false , SimpleMixSplit>;
226182 Table table (array_size);
227- table.AddAll (array, 0 , array_size);
183+ for (size_t i = 0 ; i < array_size; i++) {
184+ table.Add (array[i]);
185+ }
228186 end = clock ();
229187 printf (" Done in %.3f seconds.\n " , (float )(end - start) / CLOCKS_PER_SEC);
230188 if (verify) {
0 commit comments