diff options
author | Andy Wingo <wingo@pobox.com> | 2014-02-07 17:53:01 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2014-02-07 17:53:01 +0100 |
commit | a675a2e81b792b9f860bec57c38a1948631c7a41 (patch) | |
tree | 36e0bffe82aad2bd33286dce05b3ecc616506443 /module/srfi/srfi-4.scm | |
parent | 9b5da400dde6e6bc8fd0e318e7ca1feffa5870db (diff) | |
download | guile-a675a2e81b792b9f860bec57c38a1948631c7a41.tar.gz |
SRFI-4 predicates, length accessors only accept bytevectors (not arrays)
* module/srfi/srfi-4.scm (define-bytevector-type): For the predicates
and length accessors, only accept bytevectors. Since arrays don't
work for u32vector-ref et al, they shouldn't pass u32vector?.
Diffstat (limited to 'module/srfi/srfi-4.scm')
-rw-r--r-- | module/srfi/srfi-4.scm | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/module/srfi/srfi-4.scm b/module/srfi/srfi-4.scm index c6eb00bf0..5b7b894f6 100644 --- a/module/srfi/srfi-4.scm +++ b/module/srfi/srfi-4.scm @@ -1,7 +1,7 @@ ;;; srfi-4.scm --- Homogeneous Numeric Vector Datatypes ;; Copyright (C) 2001, 2002, 2004, 2006, 2009, 2010, -;; 2012 Free Software Foundation, Inc. +;; 2012, 2014 Free Software Foundation, Inc. ;; ;; This library is free software; you can redistribute it and/or ;; modify it under the terms of the GNU Lesser General Public @@ -75,14 +75,11 @@ (define-macro (define-bytevector-type tag infix size) `(begin (define (,(symbol-append tag 'vector?) obj) - (and (uniform-vector? obj) - (eq? (uniform-vector-element-type obj) ',tag))) + (and (bytevector? obj) (eq? (array-type obj) ',tag))) (define (,(symbol-append 'make- tag 'vector) len . fill) (apply make-srfi-4-vector ',tag len fill)) (define (,(symbol-append tag 'vector-length) v) - (let ((len (* (uniform-vector-length v) - (uniform-vector-element-size v) - (/ ,size)))) + (let ((len (/ (bytevector-length v) ,size))) (if (integer? len) len (error "fractional length" v ',tag ,size)))) |