[gambit-list] Couple more inlining suggestions

Bradley Lucier lucier at math.purdue.edu
Wed Mar 8 13:09:01 EST 2006


I'm just going through the O(N^2) parts of my image smoothing codes  
and listing the things that come up.

Brad

1. (sqrt x)

=>

(if (and (##flonum? x)
          (##flonum.<= 0. x))  ;; OK for infinities and NaNs
     (##flonum.sqrt x)
     (sqrt x))

2. (max x y)

=>

(cond ((and (##fixnum? x) (##fixnum? y))
        (##fixnum.max x y))
       ((and (##flonum? x) (##flonum? y))
        (##flonum.max x y))
       (else
         (max x y)))

3.  Same for min.





More information about the Gambit-list mailing list