diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-10-15 23:29:50 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-10-15 23:29:50 +0200 |
commit | cd48c32cf4c1f627e9f9eeb8f7e077e0a414eab8 (patch) | |
tree | f233eb69d4789e6dd931485d2740e7254639ae3f | |
parent | 29553c54b597880d329013c6b4b435e2949a9872 (diff) | |
download | guile-cd48c32cf4c1f627e9f9eeb8f7e077e0a414eab8.tar.gz |
Fix compilation of literal bitvectors.
* libguile/arrays.c (scm_from_contiguous_typed_array): Fix BYTE_LEN
sanity check for bitvectors.
* test-suite/tests/unif.test ("syntax")["bitvector is self-evaluating"]:
New test.
* module/ice-9/deprecated.scm (#\y): Fix deprecation comment: `#*' is
not a read syntax.
-rw-r--r-- | libguile/arrays.c | 3 | ||||
-rw-r--r-- | module/ice-9/deprecated.scm | 2 | ||||
-rw-r--r-- | test-suite/tests/unif.test | 7 |
3 files changed, 8 insertions, 4 deletions
diff --git a/libguile/arrays.c b/libguile/arrays.c index b9386ea10..1fd6d9245 100644 --- a/libguile/arrays.c +++ b/libguile/arrays.c @@ -243,7 +243,8 @@ scm_from_contiguous_typed_array (SCM type, SCM bounds, const void *bytes, } else { - if (rlen * (sz / 8) + rlen * (sz % 8) / 8 != byte_len) + /* byte_len ?= ceil (rlen * sz / 8) */ + if (byte_len != (rlen * sz + 7) / 8) SCM_MISC_ERROR ("byte length and dimensions do not match", SCM_EOL); } diff --git a/module/ice-9/deprecated.scm b/module/ice-9/deprecated.scm index c55e13b28..838df2df6 100644 --- a/module/ice-9/deprecated.scm +++ b/module/ice-9/deprecated.scm @@ -190,7 +190,7 @@ #\y (lambda (c port) (issue-deprecation-warning - "The `#y' bitvector syntax is deprecated. Use `#*' instead.") + "The `#y' bitvector syntax is deprecated. Use `bitvector' instead.") (let ((x (read port))) (cond ((list? x) diff --git a/test-suite/tests/unif.test b/test-suite/tests/unif.test index 5d584e86e..092f7aac2 100644 --- a/test-suite/tests/unif.test +++ b/test-suite/tests/unif.test @@ -17,7 +17,8 @@ ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA (define-module (test-suite test-unif) - #:use-module (test-suite lib)) + #:use-module ((system base compile) #:select (compile)) + #:use-module (test-suite lib)) ;;; ;;; array? @@ -546,8 +547,10 @@ (eq? 'b (array-ref a -2))))) (pass-if-exception "negative length" exception:length-non-negative - (with-input-from-string "'#1:-3(#t #t)" read))) + (with-input-from-string "'#1:-3(#t #t)" read)) + (pass-if "bitvector is self-evaluating" + (equal? (compile (bitvector)) (bitvector)))) ;;; ;;; equal? with vector and one-dimensional array |