Namespaces
Functions
-
uint8_t U8FromNativeEndian (std::span<const uint8_t, 1U> bytes)Returns a uint8_t with the value in `bytes` interpreted as the native endian
encoding of the integer for the machine.
This is suitable for decoding integers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Note that since a single byte can have only one ordering, this just copies
the byte out of the span. This provides a consistent function for the
operation nonetheless.
Defined at line 33 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint16_t U16FromNativeEndian (std::span<const uint8_t, 2U> bytes)Returns a uint16_t with the value in `bytes` interpreted as the native endian
encoding of the integer for the machine.
This is suitable for decoding integers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Defined at line 44 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint32_t U32FromNativeEndian (std::span<const uint8_t, 4U> bytes)Returns a uint32_t with the value in `bytes` interpreted as the native endian
encoding of the integer for the machine.
This is suitable for decoding integers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Defined at line 55 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint64_t U64FromNativeEndian (std::span<const uint8_t, 8U> bytes)Returns a uint64_t with the value in `bytes` interpreted as the native endian
encoding of the integer for the machine.
This is suitable for decoding integers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Defined at line 66 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int8_t I8FromNativeEndian (std::span<const uint8_t, 1U> bytes)Returns a int8_t with the value in `bytes` interpreted as the native endian
encoding of the integer for the machine.
This is suitable for decoding integers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Note that since a single byte can have only one ordering, this just copies
the byte out of the span. This provides a consistent function for the
operation nonetheless.
Defined at line 81 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int16_t I16FromNativeEndian (std::span<const uint8_t, 2U> bytes)Returns a int16_t with the value in `bytes` interpreted as the native endian
encoding of the integer for the machine.
This is suitable for decoding integers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Defined at line 91 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int32_t I32FromNativeEndian (std::span<const uint8_t, 4U> bytes)Returns a int32_t with the value in `bytes` interpreted as the native endian
encoding of the integer for the machine.
This is suitable for decoding integers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Defined at line 102 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int64_t I64FromNativeEndian (std::span<const uint8_t, 8U> bytes)Returns a int64_t with the value in `bytes` interpreted as the native endian
encoding of the integer for the machine.
This is suitable for decoding integers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Defined at line 113 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
float FloatFromNativeEndian (std::span<const uint8_t, 4U> bytes)Returns a float with the value in `bytes` interpreted as the native endian
encoding of the number for the machine.
This is suitable for decoding numbers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Defined at line 125 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
double DoubleFromNativeEndian (std::span<const uint8_t, 8U> bytes)Returns a double with the value in `bytes` interpreted as the native endian
encoding of the number for the machine.
This is suitable for decoding numbers that were always kept in native
encoding, such as when stored in shared-memory (or through IPC) as a byte
buffer. Prefer an explicit little endian when storing and reading data from
storage, and explicit big endian for network order.
Defined at line 136 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint8_t U8FromLittleEndian (std::span<const uint8_t, 1U> bytes)Returns a uint8_t with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Note that since a single byte can have only one ordering, this just copies
the byte out of the span. This provides a consistent function for the
operation nonetheless.
Defined at line 153 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint16_t U16FromLittleEndian (std::span<const uint8_t, 2U> bytes)Returns a uint16_t with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Defined at line 165 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint32_t U32FromLittleEndian (std::span<const uint8_t, 4U> bytes)Returns a uint32_t with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Defined at line 177 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint64_t U64FromLittleEndian (std::span<const uint8_t, 8U> bytes)Returns a uint64_t with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Defined at line 189 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int8_t I8FromLittleEndian (std::span<const uint8_t, 1U> bytes)Returns a int8_t with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Note that since a single byte can have only one ordering, this just copies
the byte out of the span. This provides a consistent function for the
operation nonetheless.
Defined at line 205 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int16_t I16FromLittleEndian (std::span<const uint8_t, 2U> bytes)Returns a int16_t with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Defined at line 216 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int32_t I32FromLittleEndian (std::span<const uint8_t, 4U> bytes)Returns a int32_t with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Defined at line 228 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int64_t I64FromLittleEndian (std::span<const uint8_t, 8U> bytes)Returns a int64_t with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Defined at line 240 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
float FloatFromLittleEndian (std::span<const uint8_t, 4U> bytes)Returns a float with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding numbers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Defined at line 252 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
double DoubleFromLittleEndian (std::span<const uint8_t, 8U> bytes)Returns a double with the value in `bytes` interpreted as a little-endian
encoding of the integer.
This is suitable for decoding numbers encoded explicitly in little endian,
which is a good practice with storing and reading data from storage. Use
the native-endian versions when working with values that were always in
memory, such as when stored in shared-memory (or through IPC) as a byte
buffer.
Defined at line 264 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint8_t U8FromBigEndian (std::span<const uint8_t, 1U> bytes)Returns a uint8_t with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Note that since a single byte can have only one ordering, this just copies
the byte out of the span. This provides a consistent function for the
operation nonetheless.
Defined at line 280 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint16_t U16FromBigEndian (std::span<const uint8_t, 2U> bytes)Returns a uint16_t with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Defined at line 290 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint32_t U32FromBigEndian (std::span<const uint8_t, 4U> bytes)Returns a uint32_t with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Defined at line 300 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
uint64_t U64FromBigEndian (std::span<const uint8_t, 8U> bytes)Returns a uint64_t with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Defined at line 310 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int8_t I8FromBigEndian (std::span<const uint8_t, 1U> bytes)Returns a int8_t with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Note that since a single byte can have only one ordering, this just copies
the byte out of the span. This provides a consistent function for the
operation nonetheless.
Defined at line 324 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int16_t I16FromBigEndian (std::span<const uint8_t, 2U> bytes)Returns a int16_t with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Defined at line 334 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int32_t I32FromBigEndian (std::span<const uint8_t, 4U> bytes)Returns a int32_t with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Defined at line 344 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
int64_t I64FromBigEndian (std::span<const uint8_t, 8U> bytes)Returns a int64_t with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding integers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Defined at line 354 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
template <typename Dst = int, typename Src>Dst ClampFloor (Src value)Rounds towards negative infinity (i.e., down).
Defined at line 358 of file ../../zircon/third_party/ulib/safemath/include/safemath/safe_conversions.h
-
float FloatFromBigEndian (std::span<const uint8_t, 4U> bytes)Returns a float with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding numbers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Defined at line 364 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
template <typename Dst = int, typename Src>Dst ClampCeil (Src value)Rounds towards positive infinity (i.e., up).
Defined at line 365 of file ../../zircon/third_party/ulib/safemath/include/safemath/safe_conversions.h
-
double DoubleFromBigEndian (std::span<const uint8_t, 8U> bytes)Returns a double with the value in `bytes` interpreted as a big-endian
encoding of the integer.
This is suitable for decoding numbers encoded explicitly in big endian, such
as for network order. Use the native-endian versions when working with values
that were always in memory, such as when stored in shared-memory (or through
IPC) as a byte buffer.
Defined at line 374 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
template <typename Dst = int, typename Src>Dst ClampRound (Src value)Rounds towards nearest integer, with ties away from zero.
This means that 0.5 will be rounded to 1 and 1.5 will be rounded to 2.
Similarly, -0.5 will be rounded to -1 and -1.5 will be rounded to -2.
This is normally not what you want accuracy-wise (it introduces a small bias
away from zero), and it is not the fastest option, but it is frequently what
existing code expects. Compare with saturated_cast
<Dst
>(std::nearbyint(x))
or std::lrint(x), which would round 0.5 and -0.5 to 0 but 1.5 to 2 and
-1.5 to -2.
Defined at line 380 of file ../../zircon/third_party/ulib/safemath/include/safemath/safe_conversions.h
-
std::array<uint8_t, 1U> U8ToNativeEndian (uint8_t val)Returns a byte array holding the value of a uint8_t encoded as the native
endian encoding of the integer for the machine.
This is suitable for encoding integers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 386 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 2U> U16ToNativeEndian (uint16_t val)Returns a byte array holding the value of a uint16_t encoded as the native
endian encoding of the integer for the machine.
This is suitable for encoding integers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 396 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 4U> U32ToNativeEndian (uint32_t val)Returns a byte array holding the value of a uint32_t encoded as the native
endian encoding of the integer for the machine.
This is suitable for encoding integers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 406 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 8U> U64ToNativeEndian (uint64_t val)Returns a byte array holding the value of a uint64_t encoded as the native
endian encoding of the integer for the machine.
This is suitable for encoding integers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 416 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 1U> I8ToNativeEndian (int8_t val)Returns a byte array holding the value of a int8_t encoded as the native
endian encoding of the integer for the machine.
This is suitable for encoding integers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 426 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 2U> I16ToNativeEndian (int16_t val)Returns a byte array holding the value of a int16_t encoded as the native
endian encoding of the integer for the machine.
This is suitable for encoding integers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 436 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 4U> I32ToNativeEndian (int32_t val)Returns a byte array holding the value of a int32_t encoded as the native
endian encoding of the integer for the machine.
This is suitable for encoding integers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 446 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 8U> I64ToNativeEndian (int64_t val)Returns a byte array holding the value of a int64_t encoded as the native
endian encoding of the integer for the machine.
This is suitable for encoding integers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 456 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 4U> FloatToNativeEndian (float val)Returns a byte array holding the value of a float encoded as the native
endian encoding of the number for the machine.
This is suitable for encoding numbers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 466 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 8U> DoubleToNativeEndian (double val)Returns a byte array holding the value of a double encoded as the native
endian encoding of the number for the machine.
This is suitable for encoding numbers that will always be kept in native
encoding, such as for storing in shared-memory (or sending through IPC) as a
byte buffer. Prefer an explicit little endian when storing data into external
storage, and explicit big endian for network order.
Defined at line 476 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 1U> U8ToLittleEndian (uint8_t val)Returns a byte array holding the value of a uint8_t encoded as the
little-endian encoding of the integer.
This is suitable for encoding integers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 488 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 2U> U16ToLittleEndian (uint16_t val)Returns a byte array holding the value of a uint16_t encoded as the
little-endian encoding of the integer.
This is suitable for encoding integers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 499 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 4U> U32ToLittleEndian (uint32_t val)Returns a byte array holding the value of a uint32_t encoded as the
little-endian encoding of the integer.
This is suitable for encoding integers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 510 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 8U> U64ToLittleEndian (uint64_t val)Returns a byte array holding the value of a uint64_t encoded as the
little-endian encoding of the integer.
This is suitable for encoding integers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 521 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 1U> I8ToLittleEndian (int8_t val)Returns a byte array holding the value of a int8_t encoded as the
little-endian encoding of the integer.
This is suitable for encoding integers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 532 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 2U> I16ToLittleEndian (int16_t val)Returns a byte array holding the value of a int16_t encoded as the
little-endian encoding of the integer.
This is suitable for encoding integers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 543 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 4U> I32ToLittleEndian (int32_t val)Returns a byte array holding the value of a int32_t encoded as the
little-endian encoding of the integer.
This is suitable for encoding integers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 554 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 8U> I64ToLittleEndian (int64_t val)Returns a byte array holding the value of a int64_t encoded as the
little-endian encoding of the integer.
This is suitable for encoding integers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 565 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 4U> FloatToLittleEndian (float val)Returns a byte array holding the value of a float encoded as the
little-endian encoding of the number.
This is suitable for encoding numbers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 576 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 8U> DoubleToLittleEndian (double val)Returns a byte array holding the value of a double encoded as the
little-endian encoding of the number.
This is suitable for encoding numbers explicitly in little endian, which is
a good practice with storing and reading data from storage. Use the
native-endian versions when working with values that will always be in
memory, such as when stored in shared-memory (or passed through IPC) as a
byte buffer.
Defined at line 587 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 1U> U8ToBigEndian (uint8_t val)Returns a byte array holding the value of a uint8_t encoded as the big-endian
encoding of the integer.
This is suitable for encoding integers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 599 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 2U> U16ToBigEndian (uint16_t val)Returns a byte array holding the value of a uint16_t encoded as the
big-endian encoding of the integer.
This is suitable for encoding integers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 610 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 4U> U32ToBigEndian (uint32_t val)Returns a byte array holding the value of a uint32_t encoded as the
big-endian encoding of the integer.
This is suitable for encoding integers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 621 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 8U> U64ToBigEndian (uint64_t val)Returns a byte array holding the value of a uint64_t encoded as the
big-endian encoding of the integer.
This is suitable for encoding integers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 632 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 1U> I8ToBigEndian (int8_t val)Returns a byte array holding the value of a int8_t encoded as the big-endian
encoding of the integer.
This is suitable for encoding integers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 643 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 2U> I16ToBigEndian (int16_t val)Returns a byte array holding the value of a int16_t encoded as the
big-endian encoding of the integer.
This is suitable for encoding integers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 654 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 4U> I32ToBigEndian (int32_t val)Returns a byte array holding the value of a int32_t encoded as the
big-endian encoding of the integer.
This is suitable for encoding integers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 665 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 8U> I64ToBigEndian (int64_t val)Returns a byte array holding the value of a int64_t encoded as the
big-endian encoding of the integer.
This is suitable for encoding integers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 676 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 4U> FloatToBigEndian (float val)Returns a byte array holding the value of a float encoded as the big-endian
encoding of the number.
This is suitable for encoding numbers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 687 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
-
std::array<uint8_t, 8U> DoubleToBigEndian (double val)Returns a byte array holding the value of a double encoded as the big-endian
encoding of the number.
This is suitable for encoding numbers explicitly in big endian, such as for
network order. Use the native-endian versions when working with values that
are always in memory, such as when stored in shared-memory (or passed through
IPC) as a byte buffer. Use the little-endian encoding for storing and reading
from storage.
Defined at line 698 of file ../../zircon/third_party/ulib/safemath/include/safemath/byte_conversions.h
Concepts
template <typename T> IntegralConstantLike std::is_integral_v<decltype(T::value)> && !std::is_same_v<_Bool, std::remove_const_t<decltype(T::value)> > && std::convertible_to<T, decltype(T::value)> && std::equality_comparable_with<T, decltype(T::value)> && std::bool_constant<T() == T::value>::value && std::bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value
Exposition-only concept from [span.syn]
Defined at line 14 of file ../../zircon/third_party/ulib/safemath/include/safemath/integral_constant_like.h