[coreboot] New patch to review for coreboot: cfd7999 AMD hudson: Truncate the float point number to integer

Zheng Bao (zheng.bao@amd.com) gerrit at coreboot.org
Fri Sep 21 07:08:20 CEST 2012


Zheng Bao (zheng.bao at amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1529

-gerrit

commit cfd79991438949d84fa3b178dd4f3cb64883caf1
Author: Zheng Bao <fishbaozi at gmail.com>
Date:   Fri Sep 21 15:04:31 2012 +0800

    AMD hudson: Truncate the float point number to integer
    
    From awk info:
    because all numbers in `awk' are floating-point numbers, the result is
    _not_ rounded to an integer--`3 / 4' has the value 0.75.
    
    For some system, the awk command
    printf("%c", 0.1);
    produces nothing, instead of 0. We need to convert the floating to
    integer. int(X) is an awk built-in function.
    
    Change-Id: I3470d5f13e7ea59a978d5575a54c0d56368dc78d
    Signed-off-by: Zheng Bao <zheng.bao at amd.com>
    Signed-off-by: Zheng Bao <fishbaozi at gmail.com>
---
 src/southbridge/amd/agesa/hudson/Makefile.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/southbridge/amd/agesa/hudson/Makefile.inc b/src/southbridge/amd/agesa/hudson/Makefile.inc
index 014524d..6a47080 100644
--- a/src/southbridge/amd/agesa/hudson/Makefile.inc
+++ b/src/southbridge/amd/agesa/hudson/Makefile.inc
@@ -58,7 +58,7 @@ $(obj)/hudson_romsig.bin: $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE)) \
 		$(HUDSON_IMC_POSITION) \
 		$(HUDSON_GEC_POSITION) \
 		$(HUDSON_XHCI_POSITION) ; do \
-		echo  $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, $$1/256 % 256, $$1/65536 % 256, $$1/16777216);}'; \
+		echo  $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
 	done > $@
 
 ifeq ($(CONFIG_HUDSON_FWM), y)




More information about the coreboot mailing list