Mail Archives: djgpp/1996/10/17/23:47:40
Simon Hammett wrote:
> some_routine()
> {
> asm ("
>
> movl _Y_coord, %eax
> imul $HREZ, %eax
>
> ");
> }change to:
some_routine()
{
asm ("
movl _Y_coord, %%eax
imul $%0, %%eax
"
:
:"i"(HREZ));
}
> int some_function ( int x, int y );
> {
> asm ("
>
> movl X(%sp), %eax
> imul Y(%sp), %eax
> movl %eax, RESULT( %sp )
>
> ");
> }chage to:
int some_function ( int x, int y );
{
int result;
asm ("
imul %2, %%eax
"
:"=a"(result)
:"a"(x),"g"(y) );
}
Basically, extended inline asm makes life much easier. (type 'info gcc "c ex" ex' to get more
info)
Hope this helps
Bill
- Raw text -