Changeset 36748 in project
 Timestamp:
 11/01/18 15:16:47 (5 months ago)
 Location:
 release/5/bloomfilter/trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

release/5/bloomfilter/trunk/bloomfilter.egg
r36576 r36748 4 4 ((synopsis "Bloom Filter") 5 5 (category data) 6 (version "2.2. 0")6 (version "2.2.1") 7 7 (author "[[kon lovett]]") 8 8 (license "BSD") 
release/5/bloomfilter/trunk/bloomfilter.scm
r36631 r36748 349 349 (*bloomfilterm bf)) ) 350 350 351 (: *biton! (booleanset fixnum > booleanset))352 ; 353 (define ( *biton! bits idx)351 (: biton! (booleanset fixnum > booleanset)) 352 ; 353 (define (biton! bits idx) 354 354 (bitvectorset! bits idx #t) 355 355 bits ) 356 356 357 (: *makebitcounter (booleanset > (fixnum fixnum > fixnum))) 358 ; 359 (defineinline (*makebitcounter bits) 360 (lambda (cnt idx) (if (bitvectorref bits idx) (fx+ cnt 1) cnt)) ) 361 362 (: *bloomfilterexists? (bloomfilter * > boolean)) 363 ; 364 (defineinline (*bloomfilterexists? bf obj) 365 (let* ( 366 (bits (*bloomfilterbits bf)) 367 (bitcnt (bloomfilterfoldl bf (*makebitcounter bits) 0 obj)) ) 368 (fx<= (*bloomfilterk bf) bitcnt) ) ) 369 370 (: bloomfilterexists? (bloomfilter * > boolean)) 371 ; 372 (define (bloomfilterexists? bf obj) 373 (*bloomfilterexists? (checkbloomfilter 'bloomfilterexists? bf) obj) ) 374 357 375 (: bloomfilterset! (bloomfilter * > void)) 358 376 ; 359 377 (define (bloomfilterset! bf obj) 360 378 ;tracks actual pop (n) so cannot "reset" 361 (unless ( bloomfilterexists? (checkbloomfilter 'bloomfilterset! bf) obj)379 (unless (*bloomfilterexists? (checkbloomfilter 'bloomfilterset! bf) obj) 362 380 ;spray rep bits 363 (let ((bits (bloomfilterfoldl bf *biton! (*bloomfilterbits bf) obj)))381 (let ((bits (bloomfilterfoldl bf biton! (*bloomfilterbits bf) obj))) 364 382 (*bloomfilterbitsset! bf bits) ) 365 383 ;bump actual pop 366 384 (*bloomfilternset! bf (fx+ (*bloomfiltern bf) 1)) ) ) 367 385 368 (: makebitcounter (booleanset > (fixnum fixnum > fixnum)))369 ;370 (define ((makebitcounter bits) cnt idx)371 (if (bitvectorref bits idx) (fx+ cnt 1) cnt) )372 373 (: bloomfilterexists? (bloomfilter * > boolean))374 ;375 (define (bloomfilterexists? bf obj)376 (let* (377 (bits (*bloomfilterbits (checkbloomfilter 'bloomfilterexists? bf)))378 (bitcnt (bloomfilterfoldl bf (makebitcounter bits) 0 obj)) )379 (fx<= (*bloomfilterk bf) bitcnt) ) )380 381 386 ) ;module bloomfilter
Note: See TracChangeset
for help on using the changeset viewer.