Next: stdlib list, Previous: stdlib unicode, Up: stdlib [Index]
Many applications deal with blocks of binary data by accessing them in
various ways—extracting signed or unsigned numbers of various sizes.
Therefore, the (rnrs bytevectors (6))
library provides a single type
for blocks of binary data with multiple ways to access that data. It
deals with integers and floating–point representations in various sizes
with specified endianness.
Bytevectors are objects of a disjoint type. Conceptually, a bytevector represents a sequence of 8-bit bytes. The description of bytevectors uses the term byte for an exact integer object in the interval (-128, …, 127) and the term octet for an exact integer object in the interval (0, …, 255). A byte corresponds to its two’s complement representation as an octet.
The length of a bytevector is the number of bytes it contains. This number is fixed. A valid index into a bytevector is an exact, non–negative integer object less than the length of the bytevector. The first byte of a bytevector has index 0; the last byte has an index one less than the length of the bytevector.
Generally, the access procedures come in different flavors according to the size of the represented integer and the endianness of the representation. The procedures also distinguish signed and unsigned representations. The signed representations all use two’s complement.
Like string literals, literals representing bytevectors do not need to be quoted:
#vu8(12 23 123) ⇒ #vu8(12 23 123)
• stdlib bytevector endianness: | Endianness. | |
• stdlib bytevector general: | General operations. | |
• stdlib bytevector bytes and octets: | Operations on bytes and octets. | |
• stdlib bytevector integers: | Operations on integers of arbitrary size. | |
• stdlib bytevector integers 16: | Operations on 16-bit integers. | |
• stdlib bytevector integers 32: | Operations on 32-bit integers. | |
• stdlib bytevector integers 64: | Operations on 64-bit integers. | |
• stdlib bytevector flonum: | Operations on IEEE 754 representations. | |
• stdlib bytevector strings: | Operations on strings. |
Next: stdlib list, Previous: stdlib unicode, Up: stdlib [Index]