[MPlayer-dev-eng] add -Wall to default CFLAGS
Trent Piepho
xyzzy at speakeasy.org
Sat May 5 20:13:51 CEST 2007
On Sat, 5 May 2007, Michael Niedermayer wrote:
> > static unsigned long long attribute_used __attribute__((aligned(8))) null_one = 0x0000ffff0000ffffULL;
> > static unsigned long long attribute_used __attribute__((aligned(8))) one_null = 0xffff0000ffff0000ULL;
> >
> > I think I'll move this all back into standalone assembler anyway (to match
> > rest of mpg123 code)...
>
> ive not followed this discussion but data accessed by asm should be
> (u)intXX_t not int/long (long) later is _wrong_, long long could be
> >64bit (yes i know this is not likely but still ...)
For values used in computing addresses, and not just pointers but an array
index used in a scale-index-base addresst too, using 'long' will make code
work on both ia32 and x86-64.
uint32_t result;
uint32_t *base;
long index;
asm("mov (%1, %2, 4), %0" : "=r"(result) : "r"(base), "r"(index));
Since ia32 uses 32-bit pointers and x86-64 uses 64 bit, the pointer base
will be a different size. It's important that %2 match this size for the
instuction to be valid. If you use "int" or "uint32_t" for index, it will
use a 32-bit register, and you get an invalid address like (%rax, %ebx, 4).
I suppose the most correct type would be "intptr_t", but long works and gcc
inline assembly is by it's nature non-portable.
More information about the MPlayer-dev-eng
mailing list