This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Postioning of items within a class
- To: gcc at gcc dot gnu dot org, prometheus at lokigames dot com
- Subject: Re: Postioning of items within a class
- From: Mike Stump <mrs at windriver dot com>
- Date: Wed, 12 Jul 2000 17:02:42 -0700 (PDT)
> Date: Wed, 12 Jul 2000 12:05:39 -0400
> From: Andrew Henderson <prometheus@lokigames.com>
> I've run into a snag while porting some MASM-based inline assembly over
> to inlined GAS assembly and I was hoping for some helpful suggestions.
I can give them to you, but you may not like them... There is a thing
call the compiler, it knows about all these sorts of things and more,
it can generate the code for you, you can use it, if you want...
For example:
> MASM: mov dword ptr [my_pointer + dummy.item2], eax
> GAS: movl %eax, 4(my_pointer)
asm ("mov %%eax, %0", ... &my_pointer->item2)
asm ("mov %%eax, %0(my_pointer)", ... offsetof(item2))
It is amazing how far out of your way you'll go to avoid the compiler.
Hint, don't, it is your best friend. In fact, add the intrinsics you
need to the md file and the compiler, and then add builtins for them,
and you won't even need the inline assembler much after that.
I know, your a game programmer, and doing this can produce sucky code
from time to time... But in the case you give, I think you'd be ok
using it.