Byte-order utilities: read/write 16-bit and 32-bit integers in little-endian or big-endian order.
More...
#include <stdint.h>
Go to the source code of this file.
|
| static uint16_t | sys_get_le16 (const uint8_t *p) |
| | Read a 16-bit little-endian value from a byte buffer.
|
| |
| static uint32_t | sys_get_le32 (const uint8_t *p) |
| | Read a 32-bit little-endian value from a byte buffer.
|
| |
| static uint16_t | sys_get_be16 (const uint8_t *p) |
| | Read a 16-bit big-endian value from a byte buffer.
|
| |
| static uint32_t | sys_get_be32 (const uint8_t *p) |
| | Read a 32-bit big-endian value from a byte buffer.
|
| |
| static void | sys_put_le16 (uint16_t v, uint8_t *p) |
| | Write a 16-bit value to a byte buffer in little-endian order.
|
| |
| static void | sys_put_le32 (uint32_t v, uint8_t *p) |
| | Write a 32-bit value to a byte buffer in little-endian order.
|
| |
| static void | sys_put_be16 (uint16_t v, uint8_t *p) |
| | Write a 16-bit value to a byte buffer in big-endian order.
|
| |
| static void | sys_put_be32 (uint32_t v, uint8_t *p) |
| | Write a 32-bit value to a byte buffer in big-endian order.
|
| |
Byte-order utilities: read/write 16-bit and 32-bit integers in little-endian or big-endian order.
◆ sys_get_be16()
| static uint16_t sys_get_be16 |
( |
const uint8_t * |
p | ) |
|
|
inlinestatic |
Read a 16-bit big-endian value from a byte buffer.
- Parameters
-
| p | Pointer to the byte buffer. |
- Returns
- The 16-bit value in native byte order.
◆ sys_get_be32()
| static uint32_t sys_get_be32 |
( |
const uint8_t * |
p | ) |
|
|
inlinestatic |
Read a 32-bit big-endian value from a byte buffer.
- Parameters
-
| p | Pointer to the byte buffer. |
- Returns
- The 32-bit value in native byte order.
◆ sys_get_le16()
| static uint16_t sys_get_le16 |
( |
const uint8_t * |
p | ) |
|
|
inlinestatic |
Read a 16-bit little-endian value from a byte buffer.
- Parameters
-
| p | Pointer to the byte buffer. |
- Returns
- The 16-bit value in native byte order.
◆ sys_get_le32()
| static uint32_t sys_get_le32 |
( |
const uint8_t * |
p | ) |
|
|
inlinestatic |
Read a 32-bit little-endian value from a byte buffer.
- Parameters
-
| p | Pointer to the byte buffer. |
- Returns
- The 32-bit value in native byte order.
◆ sys_put_be16()
| static void sys_put_be16 |
( |
uint16_t |
v, |
|
|
uint8_t * |
p |
|
) |
| |
|
inlinestatic |
Write a 16-bit value to a byte buffer in big-endian order.
- Parameters
-
| v | The value to write. |
| p | Pointer to the byte buffer. |
◆ sys_put_be32()
| static void sys_put_be32 |
( |
uint32_t |
v, |
|
|
uint8_t * |
p |
|
) |
| |
|
inlinestatic |
Write a 32-bit value to a byte buffer in big-endian order.
- Parameters
-
| v | The value to write. |
| p | Pointer to the byte buffer. |
◆ sys_put_le16()
| static void sys_put_le16 |
( |
uint16_t |
v, |
|
|
uint8_t * |
p |
|
) |
| |
|
inlinestatic |
Write a 16-bit value to a byte buffer in little-endian order.
- Parameters
-
| v | The value to write. |
| p | Pointer to the byte buffer. |
◆ sys_put_le32()
| static void sys_put_le32 |
( |
uint32_t |
v, |
|
|
uint8_t * |
p |
|
) |
| |
|
inlinestatic |
Write a 32-bit value to a byte buffer in little-endian order.
- Parameters
-
| v | The value to write. |
| p | Pointer to the byte buffer. |