Next: stdlib bytevector integers, Previous: stdlib bytevector general, Up: stdlib bytevector [Index]
k must be a valid index of bytevector.
The bytevector-u8-ref
procedure returns the byte at index k
of bytevector, as an octet.
The bytevector-s8-ref
procedure returns the byte at index k
of bytevector, as a (signed) byte.
(let ((b1 (make-bytevector 16 -127)) (b2 (make-bytevector 16 255))) (list (bytevector-s8-ref b1 0) (bytevector-u8-ref b1 0) (bytevector-s8-ref b2 0) (bytevector-u8-ref b2 0))) ⇒ (-127 129 -1 255)
k must be a valid index of bytevector.
The bytevector-u8-set!
procedure stores octet in element
k of bytevector.
The bytevector-s8-set!
procedure stores the two’s–complement
representation of byte in element k of bytevector.
Both procedures return unspecified values.
(let ((b (make-bytevector 16 -127))) (bytevector-s8-set! b 0 -126) (bytevector-u8-set! b 1 246) (list (bytevector-s8-ref b 0) (bytevector-u8-ref b 0) (bytevector-s8-ref b 1) (bytevector-u8-ref b 1))) ⇒ (-126 130 -10 246)
list must be a list of octets.
The bytevector->u8-list
procedure returns a newly allocated list
of the octets of bytevector in the same order.
The u8-list->bytevector
procedure returns a newly allocated
bytevector whose elements are the elements of list list, in the
same order. It is analogous to list->vector
.