What is the difference between aligned and unaligned memory access?
I work on an TMS320C64x DSP, and I want to use the intrinsic functions (C functions for assembly
Many processors have alignment restrictions on memory access. Unaligned access either generates an exception interrupt (e.g. ARM), or is just slower (e.g. x86).
_mem2 is probably implemented as fetching two bytes and using shift and or bitwise operations to make a 16-bit ushort out of them.
_amem2 probably just reads the 16-bit ushort from the specified ptr.
I don't know TMS320C64x specifically but I'd guess it requires 16-bit alignment for 16-bit memory accesses. So you can use _mem2 always but with performance penalty, and _amem2 when you can guarantee that ptr is an even address.