avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] Value negated before call ?


From: Royce Pereira
Subject: [avr-gcc-list] Value negated before call ?
Date: Fri, 29 Sep 2006 17:11:53 +0530
User-agent: Opera Mail/9.01 (Win32)

Hi all,

I have a delay loop thus:
//========================
void delay(unsigned long count)
  {
   while(count)
    --count;
  }
//========================
When I call :
       delay(2*33000);
I get:
      878:      60 ed           ldi     r22, 0xD0       ; 208
      87a:      71 e0           ldi     r23, 0x01       ; 1
      87c:      81 e0           ldi     r24, 0x01       ; 1
      87e:      90 e0           ldi     r25, 0x00       ; 0
      880:      e4 dd           rcall   .-1080          ; 0x44a <delay>
//========================
But when I call:
       delay(2*32000);
I get:
      878:      60 e0           ldi     r22, 0x00       ; 0
      87a:      7a ef           ldi     r23, 0xFA       ; 250
      87c:      8f ef           ldi     r24, 0xFF       ; 255
      87e:      9f ef           ldi     r25, 0xFF       ; 255
      880:      e4 dd           rcall   .-1080          ; 0x44a <delay>
//=========================
The value to be passed is negated before call.
Only difference between the 2 is that the 2nd multiplication result fits into a 
word(2 bytes) while the 1st does not. If I append UL to the 32000 in the 2nd 
example, I get the correct result.

But shouldn't both calls compile similarly?

Thanks & Regards,

--Royce


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]