Just a correction : div() take 2 parameters :

div_t t;
      t=div(c, 10);
      a=t.quot;
      b=t.rem;


      Eric. 

  ----- Original Message ----- 
  From: Albert Andras 
  To: avr-gcc-list@nongnu.org 
  Sent: Tuesday, December 11, 2007 4:16 PM
  Subject: Re: [avr-gcc-list] dev and mod may not be optimized


  ----- Original Message ----- 
  From: "Nathan Moore" <[EMAIL PROTECTED]>
  > unsigned char a, b, c;
  > c = some_input_function();
  > LABEL:
  > a = c/10;
  > b = c%10;
  > ...
  > 
  > ***************************************** 
  > LABEL:
  > mov r24,r18
  > ldi r22,lo8(10)
  > call __udivmodqi4
  > mov r19,r24
  > .LM436:
  > mov r24,r18
  >  call __udivmodqi4
  > 
  > If I'm understanding __udivmodqi4 it produces the results of both of
  > these with one call.  

  Acording to:
  http://www.nongnu.org/avr-libc/user-manual/structdiv__t.html

  you could do:

  div_t t;
        t=div(c/10);
        a=t.quot;
        b=t.rem;
        ????


        Andras 



------------------------------------------------------------------------------


  _______________________________________________
  AVR-GCC-list mailing list
  AVR-GCC-list@nongnu.org
  http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to