Re: Misaligned accesses with MS ARM compiler

From: Paul G. Tobey [eMVP] (ptobey_no_spam_at_instrument_no_spam.com)
Date: 04/28/04


Date: Wed, 28 Apr 2004 09:45:51 -0700

It works, though. It's defined in winnt.h.

It will change the code generated for the item so that it is accessed as an
array of two or four bytes, which will then be reassembled in a register and
used as a WORD or DWORD.

Paul T.

"Alan Gillespie" <agillesp@qualcomm.com> wrote in message
news:%23Us3D8TLEHA.4080@TK2MSFTNGP12.phx.gbl...
> At the risk of appearing ignorant - you are talking about the MS ARM
compiler as included with eVC4, aren't you? As in
> clarm.exe (I have version 12.20.9615)?
>
> I just looked at the compiler documentation and couldn't find any mention
of UNALIGNED of __unaligned anywhere.
>
> --Alan Gillespie.
>
>
> "Michael J. Salamone [eMVP]" <mikesa#at#entrek#dot#com> wrote in message
news:ug8WSkTLEHA.1264@TK2MSFTNGP12.phx.gbl...
> > Use UNALIGNED in your declararation - which resolves to __unaligned
keyword.
> >
> > --
> >
> > Michael Salamone [eMVP]
> > Entrek Software, Inc.
> > www.entrek.com
> >
> >
> >
> > "Alan Gillespie" <agillesp@qualcomm.com> wrote in message
> > news:e1TOPcTLEHA.1272@tk2msftngp13.phx.gbl...
> > >
> > > 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.
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: Misaligned accesses with MS ARM compiler
    ... array of two or four bytes, which will then be reassembled in a register and ... compiler as included with eVC4, ... >> written for the ARM ADS compiler, ...
    (microsoft.public.pocketpc.developer)
  • Re: Idea for ECMA/C# Standard - compile time hash for performance
    ... I agree with you the chance of a compiler change is slim, ... and then delegating to the standard hash for fields accessed less frequently. ... or the array lookup which would require the ... > 64-bit architecture) for each enum value that doesn't map to anything. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Q: Checking the size of a non-allocated array?
    ... an actual argument is already invalid ... First note that you don't have an unallocated array in the subroutine. ... it is comparable to disassociated or undefined pointers. ... Obviously the compiler has ...
    (comp.lang.fortran)
  • Re: Windows array allocation problem
    ... array reference has to have a 64-bit index or array subscript triplet? ... to fit in one. ... That assumes, of course, that your compiler ... limits on just about anything. ...
    (comp.lang.fortran)
  • Bounds checked arrays
    ... As everybody knows, the C language lacks ... When the state of this toggle is ON, the compiler ... Important is to know that the array updates ... We have just to allow him/her to specify what to do ...
    (comp.lang.c)