emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109150: * alloc.c (Fmake_bool_vector


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109150: * alloc.c (Fmake_bool_vector): Fix off-by-8 bug
Date: Wed, 18 Jul 2012 10:29:34 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109150
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Wed 2012-07-18 10:29:34 -0700
message:
  * alloc.c (Fmake_bool_vector): Fix off-by-8 bug
  
  when invoking (make-bool-vector N t) and N is a positive
  multiple of 8 -- the last 8 bits were mistakenly cleared.
modified:
  src/ChangeLog
  src/alloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-18 17:26:43 +0000
+++ b/src/ChangeLog     2012-07-18 17:29:34 +0000
@@ -1,5 +1,9 @@
 2012-07-18  Paul Eggert  <address@hidden>
 
+       * alloc.c (Fmake_bool_vector): Fix off-by-8 bug
+       when invoking (make-bool-vector N t) and N is a positive
+       multiple of 8 -- the last 8 bits were mistakenly cleared.
+
        Remove some struct layout assumptions in bool vectors.
        * alloc.c (bool_header_size): New constant.
        (header_size, word_size): Move earlier, as they're now used earlier.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-18 17:26:43 +0000
+++ b/src/alloc.c       2012-07-18 17:29:34 +0000
@@ -2389,7 +2389,7 @@
 
       /* Clear any extraneous bits in the last byte.  */
       p->data[length_in_chars - 1]
-       &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
+       &= (1 << ((XFASTINT (length) - 1) % BOOL_VECTOR_BITS_PER_CHAR + 1)) - 1;
     }
 
   return val;


reply via email to

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