Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (cffi:defcstruct (complex-single-float :class foreign-complex-single-float)
- (real :float)
- (imag :float))
- (cffi:defctype complex-single-float (:struct complex-single-float))
- (defmethod cffi:translate-from-foreign (ptr (type foreign-complex-single-float))
- (cffi:with-foreign-slots ((real imag) ptr (:struct complex-single-float))
- (complex real imag)))
- (defmethod cffi:expand-from-foreign (ptr (type foreign-complex-single-float))
- `(cffi:with-foreign-slots ((real imag) ,ptr (:struct complex-single-float))
- (complex real imag)))
- (defmethod cffi:translate-into-foreign-memory (value (type foreign-complex-single-float) ptr)
- (cffi:with-foreign-slots ((real imag) ptr (:struct complex-single-float))
- (setf real (realpart value)
- imag (imagpart value))))
- ;;; A test function to see if the above stuff works.
- (cffi:defcfun ("conjf" %conjf) complex-single-float
- (z :pointer))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement