From: Dirk Behme Date: Wed, 22 Jul 2009 17:51:56 +0200 Subject: [U-Boot] [PATCH v2] Use do_div from div64.h for vsprintf Message-ID: <1248277916-4623-1-git-send-email-dirk.behme@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Use do_div from div64.h for vsprintf in case of 64bit division. For 32bit division, do_div from div64.h can't be used as it needs a 64bit parameter. Signed-off-by: Dirk Behme CC: Simon Kagstrom --- This patch replaces first version http://lists.denx.de/pipermail/u-boot/2009-July/055599.html due to compiler warnings http://lists.denx.de/pipermail/u-boot/2009-July/056994.html lib_generic/vsprintf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) Index: u-boot-main/lib_generic/vsprintf.c =================================================================== --- u-boot-main.orig/lib_generic/vsprintf.c +++ u-boot-main/lib_generic/vsprintf.c @@ -22,18 +22,19 @@ extern int do_reset (cmd_tbl_t *cmdtp, i #endif #ifdef CONFIG_SYS_64BIT_VSPRINTF +#include # define NUM_TYPE long long #else # define NUM_TYPE long -#endif -#define noinline __attribute__((noinline)) - #define do_div(n, base) ({ \ unsigned int __res; \ __res = ((unsigned NUM_TYPE) n) % base; \ n = ((unsigned NUM_TYPE) n) / base; \ __res; \ }) +#endif +#define noinline __attribute__((noinline)) + const char hex_asc[] = "0123456789abcdef"; #define hex_asc_lo(x) hex_asc[((x) & 0x0f)]