To access data on nonaligned boundaries, you have to access
the data one byte at a time (the correct endian order is
preserved during byte access).
The following macros (documented as functions for convenience) accomplish this:
- uint16_t UNALIGNED_RET16( uint16_t *addr16 )
- Returns a 16-bit quantity from the address specified by addr16.
- uint32_t UNALIGNED_RET32( uint32_t *addr32 )
- Returns a 32-bit quantity from the address specified by addr32.
- uint64_t UNALIGNED_RET64( uint64_t *addr64 )
- Returns a 64-bit quantity from the address specified by addr64.
- void UNALIGNED_PUT16( uint16_t *addr16, uint16_t val16 )
- Stores the 16-bit value val16 at the address specified by addr16.
- void UNALIGNED_PUT32( uint32_t *addr32, uint32_t val32 )
- Stores the 32-bit value val32 at the address specified by addr32.
- void UNALIGNED_PUT64( uint64_t *addr64, uint64_t val64 )
- Stores the 64-bit value val64 the address specified by addr64.