Lely core libraries
2.3.4
|
This header file is part of the utilities library; it contains the byte order (endianness) function definitions. More...
Go to the source code of this file.
Macros | |
#define | LELY_BIG_ENDIAN 1 |
The target platform is big-endian. | |
#define | LELY_LITTLE_ENDIAN 1 |
The target platform is little-endian. | |
Functions | |
uint_least16_t | htobe16 (uint_least16_t x) |
Converts a 16-bit unsigned integer from host to big-endian byte order. | |
uint_least16_t | htole16 (uint_least16_t x) |
Converts a 16-bit unsigned integer from host to little-endian byte order. | |
uint_least32_t | htobe32 (uint_least32_t x) |
Converts a 32-bit unsigned integer from host to big-endian byte order. | |
uint_least32_t | htole32 (uint_least32_t x) |
Converts a 32-bit unsigned integer from host to little-endian byte order. | |
uint_least64_t | htobe64 (uint_least64_t x) |
Converts a 64-bit unsigned integer from host to big-endian byte order. | |
uint_least64_t | htole64 (uint_least64_t x) |
Converts a 64-bit unsigned integer from host to little-endian byte order. | |
void | stbe_i16 (uint_least8_t dst[2], int_least16_t x) |
Stores a 16-bit signed integer in big-endian byte order. | |
int_least16_t | ldbe_i16 (const uint_least8_t src[2]) |
Loads a 16-bit signed integer in big-endian byte order. | |
void | stbe_u16 (uint_least8_t dst[2], uint_least16_t x) |
Stores a 16-bit unsigned integer in big-endian byte order. | |
uint_least16_t | ldbe_u16 (const uint_least8_t src[2]) |
Loads a 16-bit unsigned integer in big-endian byte order. | |
void | stle_i16 (uint_least8_t dst[2], int_least16_t x) |
Stores a 16-bit signed integer in little-endian byte order. | |
int_least16_t | ldle_i16 (const uint_least8_t src[2]) |
Loads a 16-bit signed integer in little-endian byte order. | |
void | stle_u16 (uint_least8_t dst[2], uint_least16_t x) |
Stores a 16-bit unsigned integer in little-endian byte order. | |
uint_least16_t | ldle_u16 (const uint_least8_t src[2]) |
Loads a 16-bit unsigned integer in little-endian byte order. | |
void | stbe_i32 (uint_least8_t dst[4], int_least32_t x) |
Stores a 32-bit signed integer in big-endian byte order. | |
int_least32_t | ldbe_i32 (const uint_least8_t src[4]) |
Loads a 32-bit signed integer in big-endian byte order. | |
void | stbe_u32 (uint_least8_t dst[4], uint_least32_t x) |
Stores a 32-bit unsigned integer in big-endian byte order. | |
uint_least32_t | ldbe_u32 (const uint_least8_t src[4]) |
Loads a 32-bit unsigned integer in big-endian byte order. | |
void | stle_i32 (uint_least8_t dst[4], int_least32_t x) |
Stores a 32-bit signed integer in little-endian byte order. | |
int_least32_t | ldle_i32 (const uint_least8_t src[4]) |
Loads a 32-bit signed integer in little-endian byte order. | |
void | stle_u32 (uint_least8_t dst[4], uint_least32_t x) |
Stores a 32-bit unsigned integer in little-endian byte order. | |
uint_least32_t | ldle_u32 (const uint_least8_t src[4]) |
Loads a 32-bit unsigned integer in little-endian byte order. | |
void | stbe_i64 (uint_least8_t dst[8], int_least64_t x) |
Stores a 64-bit signed integer in big-endian byte order. | |
int_least64_t | ldbe_i64 (const uint_least8_t src[8]) |
Loads a 64-bit signed integer in big-endian byte order. | |
void | stbe_u64 (uint_least8_t dst[8], uint_least64_t x) |
Stores a 64-bit unsigned integer in big-endian byte order. | |
uint_least64_t | ldbe_u64 (const uint_least8_t src[8]) |
Loads a 64-bit unsigned integer in big-endian byte order. | |
void | stle_i64 (uint_least8_t dst[8], int_least64_t x) |
Stores a 64-bit signed integer in little-endian byte order. | |
int_least64_t | ldle_i64 (const uint_least8_t src[8]) |
Loads a 64-bit signed integer in little-endian byte order. | |
void | stle_u64 (uint_least8_t dst[8], uint_least64_t x) |
Stores a 64-bit unsigned integer in little-endian byte order. | |
uint_least64_t | ldle_u64 (const uint_least8_t src[8]) |
Loads a 64-bit unsigned integer in little-endian byte order. | |
void | bcpybe (uint_least8_t *dst, int dstbit, const uint_least8_t *src, int srcbit, size_t n) |
Copies n bits from a source to a destination buffer. More... | |
void | bcpyle (uint_least8_t *dst, int dstbit, const uint_least8_t *src, int srcbit, size_t n) |
Copies n bits from a source to a destination buffer. More... | |
This header file is part of the utilities library; it contains the byte order (endianness) function definitions.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file endian.h.
void bcpybe | ( | uint_least8_t * | dst, |
int | dstbit, | ||
const uint_least8_t * | src, | ||
int | srcbit, | ||
size_t | n | ||
) |
Copies n bits from a source to a destination buffer.
The buffers MUST NOT overlap. This function assumes a big-endian bit ordering (i.e., bit 0 is the most significant bit). On platforms where CHAR_BIT != 8
, only the 8 least significant bits of each byte are copied.
dst | a pointer to the destination buffer. |
dstbit | the destination offset (in bits) with respect to dst. |
src | a pointer to the source buffer. |
srcbit | the source offset (in bits) with respect to src. |
n | the number of bits to copy. |
void bcpyle | ( | uint_least8_t * | dst, |
int | dstbit, | ||
const uint_least8_t * | src, | ||
int | srcbit, | ||
size_t | n | ||
) |
Copies n bits from a source to a destination buffer.
The buffers MUST NOT overlap. This function assumes a little-endian bit ordering (i.e., bit 0 is the least significant bit). On platforms where CHAR_BIT != 8
, only the 8 least significant bits of each byte are copied.
dst | a pointer to the destination buffer. |
dstbit | the destination offset (in bits) with respect to dst. |
src | a pointer to the source buffer. |
srcbit | the source offset (in bits) with respect to src. |
n | the number of bits to copy. |