These utility macros are useful when passing data back and forth between ARM code (for instance, a PNO) and 68K code.
The header file ByteOrderUtils.h
declares the API that this chapter describes.
ByteOrderUtils Functions and Macros
EndianSwap16 Macro
Purpose
Byte-swap a 16-bit quantity, changing it from big-endian to little-endian or vice-versa.
Declared In
ByteOrderUtils.h
Prototype
#define EndianSwap16 (
n
)
Parameters
Returns
The byte-swapped equivalent of the supplied 16-bit value.
See Also
EndianSwap32 Macro
Purpose
Byte-swap a 32-bit quantity, changing it from big-endian to little-endian or vice-versa.
Declared In
ByteOrderUtils.h
Prototype
#define EndianSwap32 (
n
)
Parameters
Returns
The byte-swapped equivalent of the supplied 32-bit value.
See Also
Read68KUnaligned32 Macro
Purpose
Read a 32-bit quantity from a local variable while byte-swapping it. The address from which the 32-bit quantity is read doesn't have to be aligned on either a 2-byte or 4-byte boundary.
Declared In
ByteOrderUtils.h
Prototype
#define Read68KUnaligned32 (
addr
)
Parameters
Returns
The byte-swapped equivalent of the 32-bit value read from the supplied address.
Comments
ARM processors require that 4-byte integers be aligned on a 4-byte boundary. 68K processors require only even address (2-byte) alignment.
See Also
EndianSwap32()
, Write68KUnaligned32()
Write68KUnaligned32 Macro
Purpose
Write a 32-bit quantity to a local variable while byte-swapping it. The address to which the 32-bit quantity is written doesn't have to be aligned on either a 2-byte or 4-byte boundary.
Declared In
ByteOrderUtils.h
Prototype
#define Write68KUnaligned32 (addr
,value
)
Parameters
-
→ addr
- Address to which the value is to be written.
-
→ value
- The 32-bit value to be byte-swapped and written.
Returns
Comments
ARM processors require that 4-byte integers be aligned on a 4-byte boundary. 68K processors require only even address (2-byte) alignment.
See Also
EndianSwap32()
, Read68KUnaligned32()