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

Extend bytevector-fill! to handle a partial fill

* libguile/bytevectors.c (bytevector-fill!): As stated.
  (scm_bytevector_fill_x): Stub to avoid changing the C API.
* doc/ref/api-data.texi: Documentation.
* libguile/vectors.c (vector-fill!): Less confusing variable names.
* test-suite/tests/bytevectors.test: Test partial fill cases for
  bytevector-fill!.
This commit is contained in:
Daniel Llorens 2021-08-17 16:47:04 +02:00
parent 926f70f9b5
commit 9a62f7caca
4 changed files with 63 additions and 28 deletions

View file

@ -65,6 +65,20 @@
(bytevector-fill! bv -128)
bv))
;; This is a Guile-specific extension.
(pass-if-equal "bytevector-fill! range arguments I"
#vu8(0 0 1 1 1)
(let ((bv (make-bytevector 5 0)))
(bytevector-fill! bv 1 2)
bv))
;; This is a Guile-specific extension.
(pass-if-equal "bytevector-fill! range arguments II"
#vu8(0 0 1 1 0)
(let ((bv (make-bytevector 5 0)))
(bytevector-fill! bv 1 2 4)
bv))
(pass-if "bytevector-copy! overlapping"
;; See <http://debbugs.gnu.org/10070>.
(let ((b (u8-list->bytevector '(1 2 3 4 5 6 7 8))))