summaryrefslogtreecommitdiff
path: root/module/srfi/srfi-4/gnu.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2012-03-01 16:07:28 -0500
committerMark H Weaver <mhw@netris.org>2012-03-01 16:16:18 -0500
commitef405f8ba73fc57706d7155a2e008352416debcf (patch)
tree81dbc0739ac01c0a05e0fc6912c916743ae29bb4 /module/srfi/srfi-4/gnu.scm
parentd316047326fde9d63ca52c0051fbf09124ef297e (diff)
downloadguile-ef405f8ba73fc57706d7155a2e008352416debcf.tar.gz
Fix <TAG>vector-length when applied to other uniform vector types
* module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm (define-bytevector-type): Fix definition of <TAG>vector-length when applied to uniform vectors of different element sizes. Thanks to Tobias Brandt <tob.brandt@googlemail.com> for reporting this bug. * test-suite/tests/srfi-4.test: Add tests.
Diffstat (limited to 'module/srfi/srfi-4/gnu.scm')
-rw-r--r--module/srfi/srfi-4/gnu.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/module/srfi/srfi-4/gnu.scm b/module/srfi/srfi-4/gnu.scm
index ac22809ea..39d6350e7 100644
--- a/module/srfi/srfi-4/gnu.scm
+++ b/module/srfi/srfi-4/gnu.scm
@@ -1,6 +1,6 @@
;;; Extensions to SRFI-4
-;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2010, 2011, 2012 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
@@ -52,7 +52,8 @@
(apply make-srfi-4-vector ',tag len fill))
(define (,(symbol-append tag 'vector-length) v)
(let ((len (* (uniform-vector-length v)
- (/ ,size (uniform-vector-element-size v)))))
+ (uniform-vector-element-size v)
+ (/ ,size))))
(if (integer? len)
len
(error "fractional length" v ',tag ,size))))