
31 Jul
2007
31 Jul
'07
10:27 p.m.
In message 46AF8CF0.7090600@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 \
string.o vsprintf.o zlib.ocrc32.o ctype.o display_options.o div64.o ldiv.o sha1.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@denx.de
"We Americans, we're a simple people... but piss us off, and we'll
bomb your cities." - Robin Williams, _Good Morning Vietnam_