[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stack-consing double-floats...



  I want to allocate (and initialize from fixnums or short-floats)
some double-floats on the stack.  I plan to pass the double floats
to a function which uses Erann Gat's FPC and coerce the result back
into a short-float for the return value.

  I found an internal CCL macro: CCL::WITH-STACK-DOUBLE-FLOATS
which does what I want, but initializes the floats to 0.0.  I
can't figure out how to initialize them to something else w/o
causing a new double-float to be consed.  The macro expands
like this:

  (ccl::with-stack-double-floats (x) <body-stuff>)

=> (let* (((x (locally (declare (notinline float)) (float 0 0.0)))))
     (declare (dynamic-extent x))
     <body-stuff>)

  There seems to be an extra nesting of parentheses around the
first argument to LET*, but functions using this macro seem to
compile ok.  So I decided to try to write a macro which does
the same thing but allows me to initialize the value of the
stack-consed double.  My macro expands to the exact same code
as CCL::WITH-STACK-DOUBLE-FLOATS, but with the first argument
to FLOAT replaced with an initialization form.  When I try to
use this in a function, I get:

  Error: While compiling ....
   (x (locally (declare (notinline float))
        (float <my-init-form> 0.0)))
  is not a symbol.

The initialization form is a function call which returns a
short float and does not cons.

  What gives?  I'm stuck....

   ...Bill
-- 
   / Bill Andersen (waander@cs.umd.edu) /
  / University of Maryland             /
 / Department of Computer Science     /
/ College Park, Maryland  20742      /