Byte order #
Conversions between the arrays with elements wider than a byte and ByteArray, in little-endian
(LE, least significant byte first) or big-endian (BE, most significant byte first) order, and
in-place byte swaps of the integer arrays. Floats are converted through their IEEE 754 bits.
Slice.ofBytes… reads the bytes of a UInt8Array.Slice instead, such as the part of a
ByteArray after a header, without copying the rest.
The results do not depend on the byte order of the machine. That byte order is computed once, when
the module is initialized: when a conversion asks for the machine's own order, it copies the whole
array at once. Otherwise ofBytes… copies and then swaps the bytes of each element in place, and
toBytes… is a loop of shifts and byte accesses, which the C compiler turns into whole-word loads,
stores and byte swap instructions.
Experimental. The names and types here may still change. import ScalarArray does not import
this module; use import ScalarArray.Bytes.
This module is generated by scripts/generate.py; edit scripts/bytes_template.py instead.
Reverses the order of the bytes of x.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reverses the order of the bytes of each element, in place when a is not shared.
Equations
Instances For
The elements of s as bytes, each in little-endian order, least significant byte first.
Equations
Instances For
The elements of a as bytes, each in little-endian order, least significant byte first.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Returns none if the size of b is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Panics if the size of b is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Returns none if the size of s is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Panics if the size of s is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in big-endian order, most significant byte first.
Equations
Instances For
The elements of a as bytes, each in big-endian order, most significant byte first.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Returns none if the size of b is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Panics if the size of b is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Returns none if the size of s is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Panics if the size of s is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reverses the order of the bytes of each element, in place when a is not shared.
Equations
Instances For
The elements of s as bytes, each in little-endian order, least significant byte first.
Equations
Instances For
The elements of a as bytes, each in little-endian order, least significant byte first.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Returns none if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Panics if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Returns none if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Panics if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in big-endian order, most significant byte first.
Equations
Instances For
The elements of a as bytes, each in big-endian order, most significant byte first.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Returns none if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Panics if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Returns none if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Panics if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reverses the order of the bytes of each element, in place when a is not shared.
Equations
Instances For
The elements of s as bytes, each in little-endian order, least significant byte first.
Equations
Instances For
The elements of a as bytes, each in little-endian order, least significant byte first.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Returns none if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Panics if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Returns none if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Panics if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in big-endian order, most significant byte first.
Equations
Instances For
The elements of a as bytes, each in big-endian order, most significant byte first.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Returns none if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Panics if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Returns none if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Panics if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reverses the order of the bytes of each element, in place when a is not shared.
Equations
Instances For
The elements of s as bytes, each in little-endian order, least significant byte first.
Equations
Instances For
The elements of a as bytes, each in little-endian order, least significant byte first.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Returns none if the size of b is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Panics if the size of b is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Returns none if the size of s is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Panics if the size of s is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in big-endian order, most significant byte first.
Equations
Instances For
The elements of a as bytes, each in big-endian order, most significant byte first.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Returns none if the size of b is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Panics if the size of b is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Returns none if the size of s is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Panics if the size of s is not a multiple of 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reverses the order of the bytes of each element, in place when a is not shared.
Equations
Instances For
The elements of s as bytes, each in little-endian order, least significant byte first.
Equations
Instances For
The elements of a as bytes, each in little-endian order, least significant byte first.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Returns none if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Panics if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Returns none if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Panics if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in big-endian order, most significant byte first.
Equations
Instances For
The elements of a as bytes, each in big-endian order, most significant byte first.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Returns none if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Panics if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Returns none if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Panics if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reverses the order of the bytes of each element, in place when a is not shared.
Equations
Instances For
The elements of s as bytes, each in little-endian order, least significant byte first.
Equations
Instances For
The elements of a as bytes, each in little-endian order, least significant byte first.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Returns none if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Panics if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Returns none if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Panics if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in big-endian order, most significant byte first.
Equations
Instances For
The elements of a as bytes, each in big-endian order, most significant byte first.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Returns none if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Panics if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Returns none if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Panics if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in little-endian order, least significant byte first.
Equations
Instances For
The elements of a as bytes, each in little-endian order, least significant byte first.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Returns none if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Panics if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Returns none if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Panics if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in big-endian order, most significant byte first.
Equations
Instances For
The elements of a as bytes, each in big-endian order, most significant byte first.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Returns none if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Panics if the size of b is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Returns none if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Panics if the size of s is not a multiple of 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in little-endian order, least significant byte first.
Equations
Instances For
The elements of a as bytes, each in little-endian order, least significant byte first.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Returns none if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in little-endian order, least significant byte first.
Panics if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Returns none if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in little-endian order, least significant byte first.
Panics if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The elements of s as bytes, each in big-endian order, most significant byte first.
Equations
Instances For
The elements of a as bytes, each in big-endian order, most significant byte first.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Returns none if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads b as elements, each in big-endian order, most significant byte first.
Panics if the size of b is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Returns none if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads the bytes of s as elements, each in big-endian order, most significant byte first.
Panics if the size of s is not a multiple of 8.
Equations
- One or more equations did not get rendered due to their size.