From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Wed, 22 Jul 2009 07:13:21 +0200 Subject: [U-Boot] [PATCH 5/8]: Use do_div from div64.h for vsprintf In-Reply-To: <4A6609A1.1010201@googlemail.com> References: <20090707155510.58ae70bb@marrow.netinsight.se> <20090720215922.A516C832E416@gemini.denx.de> <4A6609A1.1010201@googlemail.com> Message-ID: <200907220713.21782.sr@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Dirk, On Tuesday 21 July 2009 20:32:01 Dirk Behme wrote: > This is because do_div() in div64.h only likes a 64bit value as first > parameter. > > So something like > > --- a/lib_generic/vsprintf.c > +++ b/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)) > + > > would do the trick. I don't know any clean way how to do this, though. I have no "better" idea as well. It's still an improvement to the current implementation. So I suggest you prepare a patch (IIRC, Simon is on vacation right now). 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 =====================================================================