(import (rnrs));R6RS(import (rnrs bytevectors));R6RS

(bytevector-s16-set!bytevectorknendianness)(bytevector-s32-set!bytevectorknendianness)(bytevector-s64-set!bytevectorknendianness)(bytevector-u16-set!bytevectorknendianness)(bytevector-u32-set!bytevectorknendianness)(bytevector-u64-set!bytevectorknendianness)(bytevector-ieee-double-set!bytevectorkxendianness)(bytevector-ieee-single-set!bytevectorkxendianness)(bytevector-s16-native-set!bytevectorkn)(bytevector-s32-native-set!bytevectorkn)(bytevector-s64-native-set!bytevectorkn)(bytevector-u16-native-set!bytevectorkn)(bytevector-u32-native-set!bytevectorkn)(bytevector-u64-native-set!bytevectorkn)(bytevector-ieee-double-native-set!bytevectorkx)(bytevector-ieee-single-native-set!bytevectorkx)

**s16**- signed 16-bit integer
**s32**- signed 32-bit integer
**s64**- signed 64-bit integer
**u16**- unsigned 16-bit integer
**u32**- unsigned 32-bit integer
**u64**- unsigned 64-bit integer
**ieee-double**- IEEE-754 double-precision float (binary64)
**ieee-single**- IEEE-754 single-precision float (binary32)

The signed variants use the two's complement representation.

The
*endianness*
is normally one of the following symbols:

**big**- Big endian. The more significant bytes come before the less significant bytes.
**little**- Little endian. The less significant bytes come before the more significant bytes.

The
**-native**
variants use the machine's native endianness and furthermore impose an
alignment requirement: the index
*k*
must be evenly divisible by the data type size (2, 4 or 8). Such an
access is said to be aligned, as opposed to an unaligned access.

The number of bytes *m* used depends on the data type and is
either two, four or eight (corresponding to 16, 32 or 64 bits). The
bytevector must be at least *k+m* bytes in length.

The integer
*n*
must be in the range [0, (2^*w*)-1] for the unsigned operations and
in the range [-(2^(*w*-1)), (2^(*w*-1))-1] for the signed operations,
where *w* is the size of the data type in bits. For the
floating point operations, *x* must be a real number object.

Unlike the equivalent operation in e.g. C, the index is not multiplied by the element size.

(u8-list->bytevector

'(255 255 255 255 255 255 255 255

255 255 255 255 255 255 255 253)))

(bytevector-u16-set! b 0 12345 (endianness little))
(bytevector-u16-ref b 0 (endianness little))

=> 12345

(bytevector-u16-native-set! b 0 12345)
(bytevector-u16-native-ref b 0)

=> 12345
(bytevector-u16-ref b 0 (endianness little))

=> unspecified

**&assertion**(R6RS)- The wrong number of arguments was passed or an argument was outside its domain.
- R7RS
- The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

- NAME
- LIBRARY
- SYNOPSIS
- DESCRIPTION
- RETURN VALUES
- EXAMPLES
- COMPATIBILITY
- ERRORS
- SEE ALSO
- STANDARDS
- AUTHORS
- BUGS