Dear Alessandro Rubini, In message <20091008074114.ga30...@mail.gnudd.com> you wrote: > > Since int is 32 also on 64bit systems, I used unsigned long.
Note that this is not guaranteed, though. It could be 64 bit as well. > /* do it one word at a time (32 bits or 64 bits) if possible */ > if ( ((count | (int)s) & (sizeof(long) - 1)) == 0) { > count /= sizeof(long); > cl = (c & 0xff) | ((c & 0xff) << 8); > cl |= cl << 16; > if (sizeof(long) > 4) > cl |= cl << 32; How about: cl = 0; for (i=0; i<sizeof(long); ++i) { cl <<= 8; cl |= c & 0xff; } GCC optimization will do the rest... 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: w...@denx.de If I don't document something, it's usually either for a good reason, or a bad reason. In this case it's a good reason. :-) - Larry Wall in <1992jan17.005405.16...@netlabs.com> _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot