From: Joe Marshall Date: Tue, 30 Mar 2010 22:25:46 +0000 (-0700) Subject: POSITIVE-FIXNUM? and NEGATIVE-FIXNUM? and appropriate guarantees. X-Git-Tag: 20100708-Gtk~71^2~5 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a15e7e0a4c8f848108be95ffe1df96374ae618b3;p=mit-scheme.git POSITIVE-FIXNUM? and NEGATIVE-FIXNUM? and appropriate guarantees. --- diff --git a/src/runtime/fixart.scm b/src/runtime/fixart.scm index 3e888c325..eb0d8ce84 100644 --- a/src/runtime/fixart.scm +++ b/src/runtime/fixart.scm @@ -108,6 +108,29 @@ USA. (flo:vector-ref floating-vector-ref 2) (flo:vector-set! floating-vector-set! 3)) +(define-guarantee fixnum "fixnum") + +(define-integrable (positive-fixnum? object) + (and (fixnum? object) + (fix:positive? object))) + +(define-integrable (negative-fixnum? object) + (and (fixnum? object) + (fix:negative? object))) + +(define-integrable (non-negative-fixnum? object) + (and (fixnum? object) + (not (fix:negative? object)))) + +(define-integrable (non-positive-fixnum? object) + (and (fixnum? object) + (not (fix:positive? object)))) + +(define-guarantee positive-fixnum "positive fixnum") +(define-guarantee negative-fixnum "negative fixnum") +(define-guarantee non-positive-fixnum "non-positive fixnum") +(define-guarantee non-negative-fixnum "non-negative fixnum") + (define-integrable (guarantee-index-fixnum object caller) (if (not (index-fixnum? object)) (error:wrong-type-argument object "index integer" caller)))