Skip to content

Commit

Permalink
the SETF needs to be wrapped, too.
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Nov 19, 2009
1 parent e5776b3 commit 2111270
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/body.lisp
Expand Up @@ -89,8 +89,8 @@
(defun (setf ,external) (new-value body)
(setf (,internal body) new-value
(,cached body) (,wrapper new-value))))))
(wrap body-mass body-%mass body-inverse-mass /)
(wrap body-inertia body-%inertia body-inverse-inertia /)
(wrap body-mass body-%mass body-inverse-mass maybe-inverse)
(wrap body-inertia body-%inertia body-inverse-inertia maybe-inverse)
(wrap body-angle body-%angle body-rotation angle->vec))

(defgeneric body-update-velocity (body gravity damping dt)
Expand Down
1 change: 1 addition & 0 deletions src/package.lisp
Expand Up @@ -8,6 +8,7 @@
:ensure-list
:clamp
:maybe/
:maybe-inverse
:fun :_
:deletef
:delete-iff
Expand Down
5 changes: 4 additions & 1 deletion src/utils.lisp
Expand Up @@ -21,10 +21,13 @@

(declaim (inline maybe/)
(ftype (function (double-float double-float) double-float) maybe/))
(defun maybe/ (a b)
(defun maybe/ (a &optional b)
;; Don't declare me (optimize speed), because that chokes SBCL
(if (zerop b) 0d0 (/ a b)))

(defun maybe-inverse (x)
(if (zerop x) 0d0 (/ x)))

(defmacro fun (&body body)
`(lambda (&optional _) (declare (ignorable _)) ,@body))

Expand Down

0 comments on commit 2111270

Please sign in to comment.