[coreboot] libpayload: Convert HEX2BIN/BIN2HEX to functions, add abs() et al

Peter Stuge peter at stuge.se
Tue Apr 8 05:01:54 CEST 2008


On Mon, Apr 07, 2008 at 08:45:57PM -0600, Jordan Crouse wrote:
> > > +	return "0123456789abcdef"[b & 15];
> > 
> > Neat. :)
> 
> Hmm - now that you mention it - thats 16 bytes of const data.
> This might be more efficient (but not as cute):
> 
> return (b < 10) ? '0' + b : 'a' + (b - 10);

That probably comes close to 16 bytes of code though.

and 2
add 2
cmp 2
jle 2
add 2

10.. (IIRC the jump is just 2 byte when this short.)

Sure, the index and and make for 4 bytes too, but do the 10 bytes
matter? :)


//Peter




More information about the coreboot mailing list