 Timestamp:
 04/08/20 20:18:08 (10 months ago)
 Location:
 release/5/hashtrie/trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

release/5/hashtrie/trunk/hashtrie.egg
r38591 r38604 5 5 6 6 ((synopsis "hashtrie") 7 (version "1.1. 2")7 (version "1.1.3") 8 8 (category data) 9 9 (author "Taylor R. Campbell, [[kon lovett]] for CHICKEN") 10 10 (license "MIT") 11 (dependencies 12 (bitwiseutils "1.0.0")) 11 (dependencies) 13 12 (testdependencies test) 14 13 (components 15 14 (extension hashtrie 16 15 (typesfile) 17 (cscoptions "O3" "d1" "local" " noprocedurechecksfortoplevelbindings") ) ) )16 (cscoptions "O3" "d1" "local" "stricttypes" "noprocedurechecksfortoplevelbindings") ) ) ) 
release/5/hashtrie/trunk/hashtrie.scm
r38590 r38604 53 53 (import (chicken foreign)) 54 54 (import (chicken bitwise)) 55 (import (only bitwiseutils bitwisecount))56 55 57 56 ;; 57 58 ;w/ cplxnum since type cannot check value! 59 (definetype real (or integer float ratnum cplxnum)) 58 60 59 61 (definetype alist (listof pair)) … … 94 96 (: stringhash (string > fixnum)) 95 97 (: symbolhash (symbol > fixnum)) 96 (: exactintegerhash ( fixnum> fixnum))97 (: realnumberhash ( float> fixnum))98 (: complexnumberhash ( cplxnum> fixnum))98 (: exactintegerhash (integer > fixnum)) 99 (: realnumberhash (real > fixnum)) 100 (: complexnumberhash (real > fixnum)) 99 101 100 102 ;; 101 103 102 (define bitcount bitwisecount) 104 ;from srfi60 example implementation  slib logical.scm 105 106 (define lognot bitwisenot) 107 108 ;@ 109 (define bitwisebitcount 110 (letrec ((logcnt (lambda (n tot) 111 (if (zero? n) 112 tot 113 (logcnt (quotient n 16) 114 (+ (vectorref 115 '#(0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4) 116 (modulo n 16)) 117 tot)))))) 118 (lambda (n) 119 (cond ((negative? n) (lognot (logcnt (lognot n) 0))) 120 ((positive? n) (logcnt n 0)) 121 (else 0))))) 122 ;@ 123 (define (logcount n) 124 (cond ((negative? n) (bitwisebitcount (lognot n))) 125 (else (bitwisebitcount n)))) 126 127 (define bitcount logcount) 128 103 129 (include "hashtrie.incl") 104 130
Note: See TracChangeset
for help on using the changeset viewer.