[gambit-list] Suggestions for inlining

Bradley Lucier lucier at math.purdue.edu
Tue Mar 7 22:47:34 EST 2006


Marc:

Here are a few things that could be inlined productively (I won't  
write the tests to see whether the functions when called are the  
standard functions).

Brad

1.

(exact->inexact x)

=>

(if (##fixnum? x)
     (##flonum.<-fixnum x)
     (exact->inexact x))

2.

(vector-ref v i)           (and all the [suf][8,16,32]vector-ref's)

=>

(if (and (##vector? v)
          (##fixnum? i)
          (##fixnum.<= 0 i)
          (##fixnum.< i (##vector-length v)))
     (##vector-ref v i)
     (vector-ref v i))

3.

(vector-set v i x)           (and all the [suf][8,16,32]vector-set's  
with appropriate checks for the value of x)


(if (and (##vector? v)
          (##fixnum? i)
          (##fixnum.<= 0 i)
          (##fixnum.< i (##vector-length v)))
     (##vector-set v i x)
     (vector-ref v i x))




More information about the Gambit-list mailing list