* [U-Boot] [PATCH v2] Use do_div from div64.h for vsprintf
@ 2009-07-22 15:51 Dirk Behme
2009-07-23 8:23 ` Stefan Roese
2009-07-26 22:10 ` Wolfgang Denk
0 siblings, 2 replies; 3+ messages in thread
From: Dirk Behme @ 2009-07-22 15:51 UTC (permalink / raw)
To: u-boot
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>
CC: Simon Kagstrom <simon.kagstrom@netinsight.net>
---
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 <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)]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] Use do_div from div64.h for vsprintf
2009-07-22 15:51 [U-Boot] [PATCH v2] Use do_div from div64.h for vsprintf Dirk Behme
@ 2009-07-23 8:23 ` Stefan Roese
2009-07-26 22:10 ` Wolfgang Denk
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2009-07-23 8:23 UTC (permalink / raw)
To: u-boot
On Wednesday 22 July 2009 17:51:56 Dirk Behme wrote:
> 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>
> CC: Simon Kagstrom <simon.kagstrom@netinsight.net>
I just did some testing on the image size effect of this patch. All this is
done on Canyonlands (PPC4xx):
a) Without 64bit printf support, without this patch
b) With 64bit printf support, without this patch
c) With 64bit printf support, with this patch
Image-type Image-size
---------------------------
a 351028
b 352536
c 351400
So without this patch the 64bit printf support increases the image size by
5390 bytes and with this patch by "only" 984 bytes.
So ack from me for this patch:
Acked-by: Stefan Roese <sr@denx.de>
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] Use do_div from div64.h for vsprintf
2009-07-22 15:51 [U-Boot] [PATCH v2] Use do_div from div64.h for vsprintf Dirk Behme
2009-07-23 8:23 ` Stefan Roese
@ 2009-07-26 22:10 ` Wolfgang Denk
1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2009-07-26 22:10 UTC (permalink / raw)
To: u-boot
Dear Dirk Behme,
In message <1248277916-4623-1-git-send-email-dirk.behme@googlemail.com> you wrote:
> 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>
> CC: Simon Kagstrom <simon.kagstrom@netinsight.net>
> ---
>
> 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(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You could end up being oddly sad and full of a strange, diffuse com-
passion which would lead you to believe that it might be a good idea
to wipe out the whole human race and start again with amoebas.
- Terry Pratchett, _Guards! Guards!_
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-26 22:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22 15:51 [U-Boot] [PATCH v2] Use do_div from div64.h for vsprintf Dirk Behme
2009-07-23 8:23 ` Stefan Roese
2009-07-26 22:10 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox