[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?
From: |
David Kelly |
Subject: |
Re: [avr-gcc-list] Initilizing complex const arrays : syntax ? |
Date: |
Mon, 19 Sep 2005 20:28:21 -0500 |
On Mon, Sep 19, 2005 at 10:19:41AM -0400, Dave Hansen wrote:
Try something like
#include <stdlib.h>
...
div_t qr;
while(x) {
qr = div(x,10);
buffer[i--] = qr.rem + '0';
x = qr.quot;
}
I'm not certain this is optimal. I haven't looked closely, but it
looks like it should be. It certainly has the opportunity to be.
Yeah! Thats what I was looking for. Exactly a FORTH /mod (pronounced
"slash mod")!
div() costs nothing to implement because its almost certain the avr-libc
division primatives will be included at link time. div() is only a macro
wrapping that routine so we can get at both dividend and remainder using
a struct. The exact same primative is used for division and modulo, the
only difference is which result is picked up.
Might be nice to add a udiv() and uldiv() to existing div() and ldiv().
--
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.
- Re: [avr-gcc-list] OT Generic C question, (continued)
- Re: [avr-gcc-list] OT Generic C question, Brian Sidebotham, 2005/09/20
- RE: [avr-gcc-list] OT Generic C question, Ron, 2005/09/20
- RE: [avr-gcc-list] OT Generic C question, Mike Murphree, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Alexandru Csete, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Mike Murphree, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Wolfgang Wegner, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Anton Erasmus, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Nils Springob, 2005/09/20
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?,
David Kelly <=
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, David Kelly, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/20
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, David Kelly, 2005/09/20
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/20
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Richard Urwin, 2005/09/18
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/18
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Christopher G. Morlier, 2005/09/18