bytevector-fill! - fill a bytevector with a value
(import (rnrs)) ;R6RS
(import (rnrs bytevectors)) ;R6RS
(bytevector-fill! bytevector fill)
This procedure stores fill in every element of bytevector. The
fill value is an exact integer in the interval [-128, 255]. Negative
fill values are interpreted as bytes, viz.:
(bytevector-fill! bytevector (bitwise-and fill #xff))
Returns unspecified values.
(let ((a (u8-list->bytevector '(1 2 3))))
(bytevector-fill! a 0)
a)
=> #vu8(0 0 0)
This procedure is sometimes useful to clear sensitive parts of memory, like
bytevectors holding cryptographic keys. This is optimistic but is not in any
way guaranteed to wipe the data from memory.
A bytevector that contains the specified value would normally be
created from scratch with make-bytevector(3scm).
The only difference in behavior between implementations should be in how fast it
runs. This procedure is not present in R7RS-small.
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
- The wrong number of arguments was passed or an argument was outside its
domain.