guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-7-g39c5363


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-7-g39c5363
Date: Fri, 11 Nov 2011 14:30:04 +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=39c5363b4fbd32f1c895e8fa8b0c8dd067907947

The branch, stable-2.0 has been updated
       via  39c5363b4fbd32f1c895e8fa8b0c8dd067907947 (commit)
      from  fb135e12a473fd9a1612a59f904cfb90877fe775 (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 39c5363b4fbd32f1c895e8fa8b0c8dd067907947
Author: Andy Wingo <address@hidden>
Date:   Thu Nov 10 22:30:02 2011 +0100

    fix bit-set*! bug (!)
    
    * libguile/bitvectors.c (scm_bit_set_star_x): Fix a long-standing (since
      2005) bug in which instead of using the kv bitvector, we actually use
      the `v' bitvector.  Also, change to allow `kv' being shorter than
      `v'.
    
    * test-suite/tests/bitvectors.test ("bit-set*!"): Add tests.

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

Summary of changes:
 libguile/bitvectors.c            |    8 ++++----
 test-suite/tests/bitvectors.test |   21 ++++++++++++++++++---
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/libguile/bitvectors.c b/libguile/bitvectors.c
index 17b0260..c569ebf 100644
--- a/libguile/bitvectors.c
+++ b/libguile/bitvectors.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 
2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 
2009, 2010, 2011 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 License
@@ -568,7 +568,7 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0,
            "\n"
            "If @var{kv} is a bit vector, then those entries where it has\n"
            "@code{#t} are the ones in @var{v} which are set to @var{obj}.\n"
-           "@var{kv} and @var{v} must be the same length.  When @var{obj}\n"
+           "@var{v} must be at least as long as @var{kv}.  When @var{obj}\n"
            "is @code{#t} it's like @var{kv} is OR'ed into @var{v}.  Or when\n"
            "@var{obj} is @code{#f} it can be seen as an ANDNOT.\n"
            "\n"
@@ -611,10 +611,10 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0,
       ssize_t kv_inc;
       const scm_t_uint32 *kv_bits;
       
-      kv_bits = scm_bitvector_elements (v, &kv_handle,
+      kv_bits = scm_bitvector_elements (kv, &kv_handle,
                                        &kv_off, &kv_len, &kv_inc);
 
-      if (v_len != kv_len)
+      if (v_len < kv_len)
        scm_misc_error (NULL,
                        "bit vectors must have equal length",
                        SCM_EOL);
diff --git a/test-suite/tests/bitvectors.test b/test-suite/tests/bitvectors.test
index 9833b3b..c16fb4d 100644
--- a/test-suite/tests/bitvectors.test
+++ b/test-suite/tests/bitvectors.test
@@ -1,6 +1,6 @@
 ;;;; bitvectors.test --- tests guile's bitvectors     -*- scheme -*-
 ;;;;
-;;;; Copyright 2010 Free Software Foundation, Inc.
+;;;; Copyright 2010, 2011 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
@@ -55,5 +55,20 @@
       (uniform-vector-set! bv 0 #t)
       (pass-if (eqv? (uniform-vector-ref bv 0) #t)))))
 
-
-
+(with-test-prefix "bit-set*!"
+  (pass-if "#t"
+    (let ((v (bitvector #t #t #f #f)))
+      (bit-set*! v #*1010 #t)
+      (equal? v #*1110)))
+  (pass-if "#f"
+    (let ((v (bitvector #t #t #f #f)))
+      (bit-set*! v #*1010 #f)
+      (equal? v #*0100)))
+  (pass-if "#t, shorter"
+    (let ((v (bitvector #t #t #f #f)))
+      (bit-set*! v #*101 #t)
+      (equal? v #*1110)))
+  (pass-if "#f, shorter"
+    (let ((v (bitvector #t #t #f #f)))
+      (bit-set*! v #*101 #f)
+      (equal? v #*0100))))


hooks/post-receive
-- 
GNU Guile



reply via email to

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