This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: long long in assembly


Hi!

I am trying to increment a 64-bit counter in assembly code.
In fact, it is a variable "unsigned long long" from C code, and
I am trying to increment it from a function written in assembly.


You can inspect the assembly code generated by gcc with the -S option.

Compiling this simple program

int main()
{
   unsigned long long a = 1234;
   a++;


return a; }

yields (only relevant lines)

   .loc 1 5 0
   movl    $1234, -8(%ebp)
   movl    $0, -4(%ebp)
   .loc 1 6 0
   leal    -8(%ebp), %eax
   addl    $1, (%eax)
   adcl    $0, 4(%eax)   // <- This should be what you are looking for
   .loc 1 9 0
   movl    -8(%ebp), %eax

greets
cm


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]