[LinuxBIOS] Convert hex to dec
Peter Stuge
peter at stuge.se
Mon Jul 9 14:32:16 CEST 2007
inline void print_info_dec(unsigned long value,unsigned long res) {
for(;res;res/=10)
print_info_char('0'+value/res%10);
}
On Mon, Jul 09, 2007 at 09:43:49AM +0300, Indrek Kruusa wrote:
> print_info("CPU ");
print_info_dec(cpu_clk,100);
> print_info(" MHz\r\n");
Note this only prints the modulus while Indrek's code indicates that
the value does not fit in 3 positions by printing a non-digit
hundreds character.
Multiply the resoluton by 10 to get more digits. 1000=4, 10000=5 etc.
Omitting leading 0:s would need some state to be kept and cost one
more register.
//Peter
More information about the coreboot
mailing list