|
Functions |
| void | buf_insert16 (uint8_t *p, uint16_t pos, uint16_t word) |
| | Insert a uint16_t into an array of bytes in little endian byte order.
|
| void | buf_insert32 (uint8_t *p, uint16_t pos, uint32_t dword) |
| | Insert a uint32_t into an array of bytes in little endian byte order.
|
| uint16_t | buf_extract16 (uint8_t *p, uint16_t pos) |
| | Extracts a little endian uint16_t from an array of bytes.
|
| uint32_t | buf_extract32 (uint8_t *p, uint16_t pos) |
| | Extracts a little endian uint32_t from an array of bytes.
|
Specifically, the buf_insert and buf_extract functions can be used instead of casting a byte pointer to a uint16_t* or uint32_t*. On some platforms such as the TELOSb, undefined behavior occurs if you read or write a 16-bit or 32-bit value to a location in memory that is not word aligned. These functions do not have such an issue.