mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-16 23:47:49 -04:00
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>
This commit is contained in:
parent
4828779238
commit
479105065d
@ -22,18 +22,19 @@ extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_64BIT_VSPRINTF
|
#ifdef CONFIG_SYS_64BIT_VSPRINTF
|
||||||
|
#include <div64.h>
|
||||||
# define NUM_TYPE long long
|
# define NUM_TYPE long long
|
||||||
#else
|
#else
|
||||||
# define NUM_TYPE long
|
# define NUM_TYPE long
|
||||||
#endif
|
|
||||||
#define noinline __attribute__((noinline))
|
|
||||||
|
|
||||||
#define do_div(n, base) ({ \
|
#define do_div(n, base) ({ \
|
||||||
unsigned int __res; \
|
unsigned int __res; \
|
||||||
__res = ((unsigned NUM_TYPE) n) % base; \
|
__res = ((unsigned NUM_TYPE) n) % base; \
|
||||||
n = ((unsigned NUM_TYPE) n) / base; \
|
n = ((unsigned NUM_TYPE) n) / base; \
|
||||||
__res; \
|
__res; \
|
||||||
})
|
})
|
||||||
|
#endif
|
||||||
|
#define noinline __attribute__((noinline))
|
||||||
|
|
||||||
|
|
||||||
const char hex_asc[] = "0123456789abcdef";
|
const char hex_asc[] = "0123456789abcdef";
|
||||||
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
|
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user