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

Replace bit-position with bitvector-position

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 (scm_bitvector_position): New function.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_bit_position): Deprecate.
* module/ice-9/sandbox.scm (bitvector-bindings): Replace bit-position
  with bitvector-position.
* module/language/cps/intset.scm (bitvector->intset): Use
  bitvector-position.
* module/system/vm/frame.scm (available-bindings): Use
  bitvector-position.
* test-suite/tests/bitvectors.test ("bitvector-position"): Add test.
This commit is contained in:
Andy Wingo 2020-04-12 22:39:55 +02:00
parent cae74359de
commit 06709d77b9
10 changed files with 97 additions and 70 deletions

View file

@ -76,5 +76,13 @@
(pass-if-equal 2 (let ((bv #*01110111))
(- (bitvector-length bv) (bitvector-count bv)))))
(with-test-prefix "bitvector-position"
(pass-if-equal 0 (bitvector-position #*01110111 #f))
(pass-if-equal 1 (bitvector-position #*01110111 #t))
(pass-if-equal 4 (bitvector-position #*01110111 #f 1))
(pass-if-equal 4 (bitvector-position #*01110111 #f 4))
(pass-if-equal 5 (bitvector-position #*01110111 #t 5))
(pass-if-equal #f (bitvector-position #*01110111 #f 5)))
(with-test-prefix "bit-count*"
(pass-if-equal 3 (bit-count* #*01110111 #*11001101 #t)))