[U-Boot-Users] ARM missing __udivdi3 in lib_arm or fix 64bit division in nand_util.c?
Wolfgang Denk
wd at denx.de
Tue Jul 31 22:27:28 CEST 2007
In message <46AF8CF0.7090600 at googlemail.com> you wrote:
>
> Something like in attachment?
Probably not.
> +/* The unnecessary pointer compare is there
> + * to check for type safety (n must be 64bit)
> + */
> +# define do_div(n,base) ({ \
> + uint32_t __base = (base); \
> + uint32_t __rem; \
> + (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
> + if (((n) >> 32) == 0) { \
> + __rem = (uint32_t)(n) % __base; \
> + (n) = (uint32_t)(n) / __base; \
> + } else \
> + __rem = __div64_32(&(n), __base); \
> + __rem; \
> + })
CodingStyle: Generally, inline functions are preferable to macros
resembling functions.
> Index: uboot/lib_generic/Makefile
> ===================================================================
> --- uboot.orig/lib_generic/Makefile
> +++ uboot/lib_generic/Makefile
> @@ -27,7 +27,7 @@ LIB = $(obj)libgeneric.a
>
> COBJS = bzlib.o bzlib_crctable.o bzlib_decompress.o \
> bzlib_randtable.o bzlib_huffman.o \
> - crc32.o ctype.o display_options.o ldiv.o sha1.o \
> + crc32.o ctype.o display_options.o div64.o ldiv.o sha1.o \
> string.o vsprintf.o zlib.o
Why should I link this code and increase the memory footprint for all
boards, when 99% of them don't need this?
Rejected.
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
"We Americans, we're a simple people... but piss us off, and we'll
bomb your cities." - Robin Williams, _Good Morning Vietnam_
More information about the U-Boot
mailing list