20/3/2008, "Jan Hoogerbrugge" <[EMAIL PROTECTED]> napisaĆ/a:
>Hi,
>
>I am looking for a way to specify that data is not aligned and that therefore
>word accesses should be expanded into byte accesses. For example:
>
>void f(__unaligned int *a)
>{
> *a = 0;
>}
>
>Expands into 4 byte stores. Any suggestions on how to implement this?
$ cat 0.c
typedef struct { unsigned value __attribute__(( packed ));
}unaligned_uint;
void f( unaligned_uint* p ) { p->value = 0; }
$ sparc-sun-solaris2.9-gcc 0.c -O2 -S produces:
f:
stb %g0, [%o0+3]
stb %g0, [%o0]
stb %g0, [%o0+1]
jmp %o7+8
stb %g0, [%o0+2]