diff options
author | Andy Wingo <wingo@pobox.com> | 2009-10-16 11:59:30 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-10-16 11:59:30 +0200 |
commit | b0fae4ecaa9f602f3183c35eb945c8050e1f3b68 (patch) | |
tree | d4aeb48a6f1d2778adb1f549c0de50a37c95101a /libguile/arrays.c | |
parent | 96e15df109ccfdcc2f6b2cffc0b64a083f000903 (diff) | |
download | guile-b0fae4ecaa9f602f3183c35eb945c8050e1f3b68.tar.gz |
bitvector tweaks
* libguile/arrays.c (scm_from_contiguous_typed_array):
* libguile/bytevectors.c (scm_uniform_array_to_bytevector): Error if the
uniform element size is more than 8 bits, but not divisible by 8 --
because our math could overflow in that case.
* module/ice-9/deprecated.scm (#\y): Indeed, #* is the valid bitvector
syntax :)
Diffstat (limited to 'libguile/arrays.c')
-rw-r--r-- | libguile/arrays.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libguile/arrays.c b/libguile/arrays.c index 1fd6d9245..8dc1d7888 100644 --- a/libguile/arrays.c +++ b/libguile/arrays.c @@ -241,12 +241,15 @@ scm_from_contiguous_typed_array (SCM type, SCM bounds, const void *bytes, if (byte_len / (sz / 8) != rlen) SCM_MISC_ERROR ("byte length and dimensions do not match", SCM_EOL); } - else + else if (sz < 8) { /* 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); } + else + /* an internal guile error, really */ + SCM_MISC_ERROR ("uniform elements larger than 8 bits must fill whole bytes", SCM_EOL); memcpy (elts, bytes, byte_len); |