guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-4-1-gb0fa


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-4-1-gb0fae4e
Date: Fri, 16 Oct 2009 09:59:37 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=b0fae4ecaa9f602f3183c35eb945c8050e1f3b68

The branch, master has been updated
       via  b0fae4ecaa9f602f3183c35eb945c8050e1f3b68 (commit)
      from  96e15df109ccfdcc2f6b2cffc0b64a083f000903 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b0fae4ecaa9f602f3183c35eb945c8050e1f3b68
Author: Andy Wingo <address@hidden>
Date:   Fri Oct 16 11:59:30 2009 +0200

    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 :)

-----------------------------------------------------------------------

Summary of changes:
 libguile/arrays.c           |    5 ++++-
 libguile/bytevectors.c      |    5 ++++-
 module/ice-9/deprecated.scm |    2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libguile/arrays.c b/libguile/arrays.c
index 1fd6d92..8dc1d78 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);
 
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index e099819..b9d2d89 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -604,9 +604,12 @@ SCM_DEFINE (scm_uniform_array_to_bytevector, 
"uniform-array->bytevector",
   sz = scm_array_handle_uniform_element_bit_size (&h);
   if (sz >= 8 && ((sz % 8) == 0))
     byte_len = len * (sz / 8);
-  else
+  else if (sz < 8)
     /* byte_len = ceil (len * sz / 8) */
     byte_len = (len * sz + 7) / 8;
+  else
+    /* an internal guile error, really */
+    SCM_MISC_ERROR ("uniform elements larger than 8 bits must fill whole 
bytes", SCM_EOL);
 
   ret = make_bytevector (byte_len, SCM_ARRAY_ELEMENT_TYPE_VU8);
   memcpy (SCM_BYTEVECTOR_CONTENTS (ret), elts, byte_len);
diff --git a/module/ice-9/deprecated.scm b/module/ice-9/deprecated.scm
index 838df2d..c55e13b 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 `bitvector' instead.")
+    "The `#y' bitvector syntax is deprecated.  Use `#*' instead.")
    (let ((x (read port)))
      (cond
       ((list? x)


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]