8-bit Endian Load/Store

The 8-bit loads and stores put values in a format suitable for bit-by-bit transition over the network or to the filesystem. Because it will serialize exactly enough bytes to memory so that it is suitable for transition over the network, it has the general requirement that when it tries to load N bit integers it expects exactly N bits to be present in the array. Therefore, CHAR_BIT % 8 must be 0 and N % 8 must be 0.

When CHAR_BIT is larger than 8 (16, 24, 32, 64, and other values that are multiples of 8), each 8-bit byte within an unsigned char is masked off with 0xFF << (8 * byte_index), and then serialized for storing/loading.

Unsigned Variants

void ztdc_store8_leuN(uint_leastN_t __value, unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Stores an 8-bit byte-specific unsigned integer in little endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores N bits, as if by performing __value = __value & (UINTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT).

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Parameters
  • __value[in] The value to be stored.

  • __ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

void ztdc_store8_beuN(uint_leastN_t __value, unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Stores an 8-bit byte-specific unsigned integer in big endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores N bits, as if by performing __value = __value & (UINTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT).

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Parameters
  • __value[in] The value to be stored.

  • __ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

uint_leastN_t ztdc_load8_leuN(const unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Loads an 8-bit byte-specific unsigned integer in little endian format in the array pointed to by __ptr by reading from __value.

Remark

Only loads N bits and leaves the rest at 0. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT).

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Parameters

__ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

uint_leastN_t ztdc_load8_beuN(const unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Loads an 8-bit byte-specific unsigned integer in big endian format in the array pointed to by __ptr by reading from __value.

Remark

Only loads N bits and leaves the rest at 0. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT).

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Parameters

__ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

void ztdc_store8_aligned_leuN(uint_leastN_t __value, unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Stores an 8-bit byte-specific unsigned integer in little endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores N bits, as if by performing __value = __value & (UINTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT).

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Precondition

The input pointer __ptr has an alignment suitable to be treated as an integral type of width N.

Parameters
  • __value[in] The value to be stored.

  • __ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

void ztdc_store8_aligned_beuN(uint_leastN_t __value, unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Stores an 8-bit byte-specific unsigned integer in big endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores N bits, as if by performing __value = __value & (UINTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT).

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Precondition

The input pointer __ptr has an alignment suitable to be treated as an integral type of width N.

Parameters
  • __value[in] The value to be stored.

  • __ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

uint_leastN_t ztdc_load8_aligned_leuN(const unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Loads an 8-bit byte-specific unsigned integer in little endian format in the array pointed to by __ptr by reading from __value.

Remark

Only loads N bits and leaves the rest at 0. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT).

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Precondition

The input pointer __ptr has an alignment suitable to be treated as an integral type of width N.

Parameters

__ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

uint_leastN_t ztdc_load8_aligned_beuN(const unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Loads an 8-bit byte-specific unsigned integer in big endian format in the array pointed to by __ptr by reading from __value.

Remark

Only loads N bits and leaves the rest at 0. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT).

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Precondition

The input pointer __ptr has an alignment suitable to be treated as an integral type of width N.

Parameters

__ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

Signed Variants

void ztdc_store8_lesN(int_leastN_t __value, unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Stores an 8-bit byte-specific signed integer in little endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores (N - 1) bits, as if by performing __value = __value & (INTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT). The sign bit is serialized into the proper location in the array as the leading (high) bit, and the mask for that is 0x7F << multiple-of-8.

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Parameters
  • __value[in] The value to be stored.

  • __ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

void ztdc_store8_besN(int_leastN_t __value, unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Stores an 8-bit byte-specific signed integer in big endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores (N - 1) bits, as if by performing __value = __value & (INTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT). The sign bit is serialized into the proper location in the array as the leading (high) bit, and the mask for that is 0x7F << multiple-of-8.

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Parameters
  • __value[in] The value to be stored.

  • __ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

int_leastN_t ztdc_load8_lesN(const unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Loads an 8-bit byte-specific signed integer in little endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores (N - 1) bits, as if by performing __value = __value & (INTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT). The sign bit is serialized into the proper location in the array as the leading (high) bit, and the mask for that is 0x7F << multiple-of-8.

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Parameters

__ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

int_leastN_t ztdc_load8_besN(const unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Loads an 8-bit byte-specific signed integer in big endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores (N - 1) bits, as if by performing __value = __value & (INTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT). The sign bit is serialized into the proper location in the array as the leading (high) bit, and the mask for that is 0x7F << multiple-of-8.

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Parameters

__ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

void ztdc_store8_aligned_lesN(int_leastN_t __value, unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Stores an 8-bit byte-specific signed integer in little endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores (N - 1) bits, as if by performing __value = __value & (INTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT). The sign bit is serialized into the proper location in the array as the leading (high) bit, and the mask for that is 0x7F << multiple-of-8.

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Precondition

The input pointer __ptr has an alignment suitable to be treated as an integral type of width N.

Parameters
  • __value[in] The value to be stored.

  • __ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

void ztdc_store8_aligned_besN(int_leastN_t __value, unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Stores an 8-bit byte-specific signed integer in big endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores (N - 1) bits, as if by performing __value = __value & (INTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT). The sign bit is serialized into the proper location in the array as the leading (high) bit, and the mask for that is 0x7F << multiple-of-8.

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Precondition

The input pointer __ptr has an alignment suitable to be treated as an integral type of width N.

Parameters
  • __value[in] The value to be stored.

  • __ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

int_leastN_t ztdc_load8_aligned_lesN(const unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Loads an 8-bit byte-specific signed integer in little endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores (N - 1) bits, as if by performing __value = __value & (INTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT). The sign bit is serialized into the proper location in the array as the leading (high) bit, and the mask for that is 0x7F << multiple-of-8.

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Precondition

The input pointer __ptr has an alignment suitable to be treated as an integral type of width N.

Parameters

__ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.

int_leastN_t ztdc_load8_aligned_besN(const unsigned char __ptr[ZTD_STATIC_PTR_EXTENT_I_(N / CHAR_BIT)])

Loads an 8-bit byte-specific signed integer in big endian format in the array pointed to by __ptr by reading from __value.

Remark

Only stores (N - 1) bits, as if by performing __value = __value & (INTN_MAX) first. Each 8-bit byte is considered according to 0xFF << multiple-of-8, where multiple-of-8 is a multiple of in the range [0, CHAR_BIT). The sign bit is serialized into the proper location in the array as the leading (high) bit, and the mask for that is 0x7F << multiple-of-8.

Constraints

  • CHAR_BIT is a multiple if 8.

  • N is a multiple of 8.

Precondition

The input pointer __ptr has an alignment suitable to be treated as an integral type of width N.

Parameters

__ptr[in] A non-null pointer to the at least N / CHAR_BIT elements.