Misaligned accesses with MS ARM compiler
From: Alan Gillespie (agillesp_at_qualcomm.com)
Date: 04/28/04
- Next message: Michael J. Salamone [eMVP]: "Re: Misaligned accesses with MS ARM compiler"
- Previous message: Paul G. Tobey [eMVP]: "Re: SMSC 91C111 / XScale Ethernet performance"
- Next in thread: Michael J. Salamone [eMVP]: "Re: Misaligned accesses with MS ARM compiler"
- Reply: Michael J. Salamone [eMVP]: "Re: Misaligned accesses with MS ARM compiler"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Apr 2004 16:39:54 +0100
Does anyone know of a way to tell the ARM compiler that a WORD or DWORD pointer addresses an object that is not (or
might not be) aligned on a 16 or 32 bit boundary?
Effectively what I want to do is this:
BYTE *pBuffer = malloc(something);
WORD *pWord = (WORD *) &pBuffer[arbitrary_offset];
DWORD *pDWord = (DWORD *) &pBuffer[another_arbitrary_offset];
*pWord = word_value; /* May be misaligned */
*pDWord = dword_value; /* May be misaligned */
I have tried various versions of #pragma pack() without success. I could, of course, use WORD and DWORD temporaries and
memcpy() into the array but that is messy. There are other, equally messy, workarounds involving byte manipulation.
The problem arises because I am porting a large amount of code that was written for the ARM ADS compiler, which has such
a facility.
Thanks,
--Alan Gillespie.
- Next message: Michael J. Salamone [eMVP]: "Re: Misaligned accesses with MS ARM compiler"
- Previous message: Paul G. Tobey [eMVP]: "Re: SMSC 91C111 / XScale Ethernet performance"
- Next in thread: Michael J. Salamone [eMVP]: "Re: Misaligned accesses with MS ARM compiler"
- Reply: Michael J. Salamone [eMVP]: "Re: Misaligned accesses with MS ARM compiler"
- Messages sorted by: [ date ] [ thread ]