1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 04:15:36 +02:00

Replace bit-count with bitvector-count

The old name was wonky and had bad argument order.

* NEWS: Add entry.
* doc/ref/api-data.texi (Bit Vectors): Update.
* libguile/bitvectors.h:
* libguile/bitvectors.c (VALIDATE_BITVECTOR): New helper.
  (scm_bitvector_count): New function.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_bit_count): Deprecate.
* module/ice-9/sandbox.scm (bitvector-bindings): Replace bit-count with
  bitvector-count.
* module/srfi/srfi-60.scm: No need to #:replace bit-count.
* module/system/vm/frame.scm (available-bindings): Use bitvector-count.
* test-suite/tests/bitvectors.test ("bitvector-count"): Add test.
This commit is contained in:
Andy Wingo 2020-04-12 22:17:22 +02:00
parent 24a34074ef
commit cae74359de
10 changed files with 88 additions and 49 deletions

View file

@ -71,5 +71,10 @@
(bit-set*! v #*101 #f)
(equal? v #*0100))))
(with-test-prefix "bitvector-count"
(pass-if-equal 6 (bitvector-count #*01110111))
(pass-if-equal 2 (let ((bv #*01110111))
(- (bitvector-length bv) (bitvector-count bv)))))
(with-test-prefix "bit-count*"
(pass-if-equal 3 (bit-count* #*01110111 #*11001101 #t)))