From a15e7e0a4c8f848108be95ffe1df96374ae618b3 Mon Sep 17 00:00:00 2001 From: Joe Marshall Date: Tue, 30 Mar 2010 15:25:46 -0700 Subject: [PATCH] POSITIVE-FIXNUM? and NEGATIVE-FIXNUM? and appropriate guarantees. --- src/runtime/fixart.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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))) -- 2.25.1