>>>>> "Jonathan" == Jonathan Simpson <[EMAIL PROTECTED]> writes:
Jonathan> I have some lisp code(a volume renderer) that accesses an alien data
Jonathan> structure. Currently, this is what I do:
Jonathan> (def-alien-variable "rawdata" (* unsigned-char))
Jonathan> and to access:
Jonathan> (defun get-vol-value (x y z)
Jonathan> (declare (fixnum x y z))
Jonathan> (deref rawdata (+ (the fixnum (* (the fixnum (* z vol-width-fixnum))
Jonathan> vol-height-fixnum))
Jonathan> (the fixnum (* y vol-width-fixnum))
Jonathan> x)))
Jonathan> As you can see, the alien type is simply a pointer to a chunk of unsigned
Jonathan> characters. The problem is that I want to access this data as if it were
Jonathan> a 3 dimensional array. My GET-VOL-VALUE function does this, albeit
Jonathan> slowly. What I want to do is cast this data structure into a new alien
Jonathan> type so that I can access it via:
Jonathan> (deref rawdata x y z)
Jonathan> This should be more efficient, correct?
I doubt it. Both still have to compute the indices in exactly the
same way.
Can't you declare the alien variable rawdata as a 3-D array to begin
with?
Ray