Re: Labels by Inline ASM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 19-mrt-04, at 9:17, Eugene wrote:


Hi !
Please, help me.
I need _quickly_ add two  _unsigned_
long and test carry flag.

For Example:
////////////////////////////////////////////////

int AddULong(ulong a, ulong b, ulong *c)
{
   *c = a + b;
    asm volatile("jc  La1");
        return 0;   // carry == 0
La1:  return 1;  //  carry == 1
}

You cannot jump out from an inline assembly block. Also, an assembler label is not the same as a C label.

But why bother... just:


int add_ulong(unsigned long a, unsigned long b, unsigned long *c) { return (*c = a + b) < a; }

...and it's portable, too!


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux