streamline srfi-4 index-argument check

svn: r12155

original commit: 8b666c17100e95ceef6a81501bcd8afa7bde55a2
This commit is contained in:
Matthew Flatt 2008-10-28 12:12:09 +00:00
parent f74e80e43a
commit 9c70829089

View File

@ -1013,13 +1013,13 @@
(list->cvector args type))
(define* (cvector-ref v i)
(if (and (integer? i) (<= 0 i (sub1 (cvector-length v))))
(if (and (exact-nonnegative-integer? i) (< i (cvector-length v)))
(ptr-ref (cvector-ptr v) (cvector-type v) i)
(error 'cvector-ref "bad index ~e for cvector bounds of 0..~e"
i (sub1 (cvector-length v)))))
(define* (cvector-set! v i x)
(if (and (integer? i) (<= 0 i (sub1 (cvector-length v))))
(if (and (exact-nonnegative-integer? i) (< i (cvector-length v)))
(ptr-set! (cvector-ptr v) (cvector-type v) i x)
(error 'cvector-ref "bad index ~e for cvector bounds of 0..~e"
i (sub1 (cvector-length v)))))
@ -1076,14 +1076,14 @@
(list->TAG vals))
(define* (TAG-ref v i)
(if (TAG? v)
(if (and (integer? i) (< -1 i (TAG-length v)))
(if (and (exact-nonnegative-integer? i) (< i (TAG-length v)))
(ptr-ref (TAG-ptr v) type i)
(error 'TAG-ref "bad index ~e for ~a bounds of 0..~e"
i 'TAG (sub1 (TAG-length v))))
(raise-type-error 'TAG-ref TAGname v)))
(define* (TAG-set! v i x)
(if (TAG? v)
(if (and (integer? i) (< -1 i (TAG-length v)))
(if (and (exact-nonnegative-integer? i) (< i (TAG-length v)))
(ptr-set! (TAG-ptr v) type i x)
(error 'TAG-set! "bad index ~e for ~a bounds of 0..~e"
i 'TAG (sub1 (TAG-length v))))