[Icc-avr] Re: sprintf limitation?

John Baraclough j_baraclough at zetnet.co.uk
Mon Jul 7 12:35:53 PDT 2008


Since VAL[x] in an 8-bit value, you might save even more code space by 
using an intermediate 'char' value.

char c;

c = (char)(VAL[0] - 48);
a = (long)(c) * 10000L;

John


Paul Mateer wrote:
> Both ways do work fine, but.....I'm at a code space premium.  The "L" 
> way gives me 29835 bytes after compression, my "2-line split" method 
> gives me 29820 bytes after compression.  FYI... before compression "L" 
> = 37449 bytes, "2-line" = 37457 bytes!
>
> On Mon, Jul 7, 2008 at 10:11 AM, Paul Mateer <paul.aa9gg at gmail.com 
> <mailto:paul.aa9gg at gmail.com>> wrote:
>
>     That works too :)
>
>
>     On Mon, Jul 7, 2008 at 9:55 AM, Andy Syms <asyms at technosoft.co.uk
>     <mailto:asyms at technosoft.co.uk>> wrote:
>
>         >  Thanks for the responses.  I found the problem:
>         >
>         > a = (VAL[0] - 48) * 10000;
>
>         Try using
>
>         a = (VAL[0] - 48) * 10000L;
>
>         to cause the expression to be evaluated as a long and not an int.
>
>
>         Andy.
>
>         _______________________________________________
>         Icc-avr mailing list
>         Icc-avr at imagecraft.com <mailto:Icc-avr at imagecraft.com>
>         http://dragonsgate.net/mailman/listinfo/icc-avr
>
>
>
>
>     -- 
>     Paul Mateer, AA9GG
>     Elan Engineering Corp.
>     www.elanengr.com <http://www.elanengr.com>
>
>
>
>
> -- 
> Paul Mateer, AA9GG
> Elan Engineering Corp.
> www.elanengr.com <http://www.elanengr.com>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Icc-avr mailing list
> Icc-avr at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-avr
>   



More information about the Icc-avr mailing list