Changeset 39389 in project
 Timestamp:
 11/25/20 20:54:08 (5 months ago)
 Location:
 release/5/fxutils/trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

release/5/fxutils/trunk/fxinlines.scm
r38103 r39389 26 26 27 27 (: fxzero? (fixnum > boolean)) 28 ; 28 (: fxpositive? (fixnum > boolean)) 29 (: fxnatural? (fixnum > boolean)) 30 (: fxnegative? (fixnum > boolean)) 31 (: fxnonpositive? (fixnum > boolean)) 32 (: fxclosedright? (fixnum fixnum fixnum > boolean)) 33 (: fxclosed? (fixnum fixnum fixnum > boolean)) 34 (: fxclosedleft? (fixnum fixnum fixnum > boolean)) 35 (: fxabs (fixnum > fixnum)) 36 (: fxadd1 (fixnum > fixnum)) 37 (: fxsub1 (fixnum > fixnum)) 38 (: fxsqr (fixnum > fixnum)) 39 (: fxcub (fixnum > fixnum)) 40 41 ;; 42 29 43 (define (fxzero? n) (fx= 0 n)) 30 44 31 (: fxpositive? (fixnum > boolean))32 ;33 45 (define (fxpositive? n) (fx< 0 n)) 34 46 35 (: fxnatural? (fixnum > boolean))36 ;37 47 (define (fxnatural? n) (fx<= 0 n)) 38 48 39 (: fxnegative? (fixnum > boolean))40 ;41 49 (define (fxnegative? n) (fx> 0 n)) 42 50 43 (: fxnonpositive? (fixnum > boolean))44 ;45 51 (define (fxnonpositive? n) (fx>= 0 n)) 46 52 47 53 ;; 48 54 49 (: fxclosedright? (fixnum fixnum fixnum > boolean))50 ;51 55 (define (fxclosedright? l x h) (and (fx< l x) (fx<= x h))) 52 56 53 (: fxclosed? (fixnum fixnum fixnum > boolean))54 ;55 57 (define (fxclosed? l x h) (and (fx<= l x) (fx<= x h))) 56 58 57 (: fxclosedleft? (fixnum fixnum fixnum > boolean))58 ;59 59 (define (fxclosedleft? l x h) (and (fx<= l x) (fx< x h))) 60 60 … … 65 65 ;; 66 66 67 (: fxabs (fixnum > fixnum))68 ;69 67 (define (fxabs n) (if (fxnegative? n) (fxneg n) n)) 70 68 71 69 ;; 72 70 73 (: fxadd1 (fixnum > fixnum))74 ;75 71 (define (fxadd1 n) (fx+ n 1)) 76 72 77 (: fxsub1 (fixnum > fixnum))78 ;79 73 (define (fxsub1 n) (fx n 1)) 80 74 81 (: fxsqr (fixnum > fixnum))82 ;83 75 (define (fxsqr n) (fx* n n)) 84 76 85 (: fxcub (fixnum > fixnum))86 ;87 77 (define (fxcub n) (fx* n (fx* n n))) 88 78 
release/5/fxutils/trunk/fxutils.scm
r39381 r39389 71 71 72 72 (: C_uword_log2 (number > number)) 73 ; 73 (: *fxrandom (fixnum > fixnum)) 74 #;(: C_pow2log2 (number > number)) 75 (: fxrandom (#!optional fixnum fixnum > fixnum)) 76 (: fxlog2 (fixnum > fixnum)) 77 (: fxpow2log2 (fixnum > fixnum)) 78 (: fxdistance* (fixnum fixnum fixnum fixnum > fixnum)) 79 (: fxdistance (fixnum fixnum fixnum fixnum > fixnum)) 80 (: fxquoandmod (fixnum fixnum > fixnum fixnum)) 81 (: fxmaxandmin (fixnum #!rest fixnum > fixnum fixnum)) 82 (: fx% (fixnum fixnum > fixnum)) 83 84 ;; 85 74 86 (define C_uword_log2 (foreignlambda long C_uword_log2 unsignedlong)) 75 87 76 88 ;; 77 89 78 (: *fxrandom (fixnum > fixnum))79 ;80 90 (defineinline (*fxrandom x) (##core#inline "C_random_fixnum" x)) 81 91 82 92 # 83 (: C_pow2log2 (number > number))84 ;85 93 (define C_pow2log2 86 94 (foreignlambda* unsignedlong ((long n)) … … 92 100 ;; 93 101 94 (: fxrandom (#!optional fixnum fixnum > fixnum))95 ;96 102 (define (fxrandom #!optional (lim mostpositivefixnum) (low 0)) 97 103 (fx+ low (*fxrandom (fx lim low))) ) … … 99 105 ;; 100 106 101 (: fxlog2 (fixnum > fixnum))102 ;103 107 (define (fxlog2 n) (C_uword_log2 n)) 104 108 105 (: fxpow2log2 (fixnum > fixnum))106 ;107 109 (define (fxpow2log2 n) 108 110 (cond … … 113 115 ;; 114 116 115 (: fxdistance* (fixnum fixnum fixnum fixnum > fixnum))116 ;117 117 (define (fxdistance* x1 y1 x2 y2) (fx+ (fxsqr (fx x1 x2)) (fxsqr (fx y1 y2)))) 118 118 119 (: fxdistance (fixnum fixnum fixnum fixnum > fixnum))120 ;121 119 (define (fxdistance x1 y1 x2 y2) (fx/ (fxdistance* x1 y1 x2 y2) 2)) 122 120 123 121 ;; 124 122 125 (: fxquoandmod (fixnum fixnum > fixnum fixnum))126 ;127 123 (define (fxquoandmod fxn fxd) (values (fx/ fxn fxd) (fxmod fxn fxd))) 128 124 129 125 ;; 130 126 131 (: fxmaxandmin (fixnum #!rest fixnum > fixnum fixnum))132 ;133 127 (define (fxmaxandmin fx . fxs) 134 128 (let loop ((fxs fxs) (mx fx) (mn fx)) … … 137 131 (let ((cur (car fxs))) 138 132 (loop (cdr fxs) (fxmax mx cur) (fxmin mn cur)) ) ) ) ) 133 ;; 134 135 (define (fx% n p) (fx/ (fx* p n) 100)) 139 136 140 137 # 141 ;;142 143 (: fx% (fixnum fixnum > fixnum))144 ;145 (define (fx% n p) (fx/ (fx* p n) 100))146 147 138 ;; 148 139
Note: See TracChangeset
for help on using the changeset viewer.