mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Fix bit-count* bug
* libguile/bitvectors.c (scm_bit_count_star): Fix typo introduced in 2005 refactor (!) in which the second arg was erroneously taken from the first arg. * test-suite/tests/bitvectors.test: Add test. * doc/ref/api-compound.texi: Fix doc example for u32vector selector.
This commit is contained in:
parent
f184e887a6
commit
d40752513f
3 changed files with 6 additions and 2 deletions
|
@ -1142,7 +1142,7 @@ For example,
|
|||
|
||||
@example
|
||||
(bit-count* #*01110111 #*11001101 #t) @result{} 3
|
||||
(bit-count* #*01110111 #u(7 0 4) #f) @result{} 2
|
||||
(bit-count* #*01110111 #u32(7 0 4) #f) @result{} 2
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
|
|
|
@ -713,7 +713,7 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 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)
|
||||
|
|
|
@ -70,3 +70,7 @@
|
|||
(let ((v (bitvector #t #t #f #f)))
|
||||
(bit-set*! v #*101 #f)
|
||||
(equal? v #*0100))))
|
||||
|
||||
(with-test-prefix "bit-count*"
|
||||
(pass-if-equal 3 (bit-count* #*01110111 #*11001101 #t))
|
||||
(pass-if-equal 2 (bit-count* #*01110111 #u32(7 0 4) #f)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue