diff options
author | Dirk Behme <dirk.behme@googlemail.com> | 2009-07-22 17:51:56 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-07-27 00:10:12 +0200 |
commit | 479105065d965121f57b55dcfe83a940cba46ac1 (patch) | |
tree | 32faf6a65c3f91fa44d149d3651fb28357ed5941 /lib_generic/vsprintf.c | |
parent | 48287792384a93d77d43aaaa1c06cac275bbe1bb (diff) |
Use do_div from div64.h for vsprintf
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 <dirk.behme@googlemail.com>
Acked-by: Stefan Roese <sr@denx.de>
CC: Simon Kagstrom <simon.kagstrom@netinsight.net>
Diffstat (limited to 'lib_generic/vsprintf.c')
-rw-r--r-- | lib_generic/vsprintf.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib_generic/vsprintf.c b/lib_generic/vsprintf.c index 7f534c7853..3d95728efb 100644 --- a/lib_generic/vsprintf.c +++ b/lib_generic/vsprintf.c @@ -22,18 +22,19 @@ extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); #endif #ifdef CONFIG_SYS_64BIT_VSPRINTF +#include <div64.h> # 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)] |