Dear Albert ARIBAUD, In message <20130418082027.4b5ea191@lilith> you wrote: > > > #ifdef USE_HOSTCC > > crc = htobe32(crc); > > memcpy(output, &crc, sizeof(crc)); > > #else > > crc = cpu_to_be32(crc); > > put_unaligned(crc, (uint32_t *)output); > > #endif > > > > This produces the same code as my original patch. If this is > > acceptable then I will do that, although it doesn't really seem any > > better. > > Wolfgang may not like it any more than put_unaligned_be32() as it > builds upon it (and the disk patch could have used the be32 version as
Indeed. > well). Personally, I think we should allow and use these... > > ... and work on optimizing their implementation for ARM; we should be > able to reduce such put()s and get()s to a few instructions. And to OK - and what about the other architectures that suffer from the same issues? > avoid any misunderstanding, yes, I volunteer for the optimizing work. :) I really dislike introducing such custom functions when we have standard functions available that implement the same purposes. Checking Linux code (as U-Boot is not representative here): -> find * -name '*.c' | wc -l 18362 -> find * -name '*.c' | xargs fgrep -l put_unaligned | wc -l 136 i. e. just 0.75% of the source files actually use any of the "put_unaligned*()" variants - it is a highly exotic function. htobe32() is even worse - just a single source file in the whole Lnux tree uses it (arch/um/drivers/cow_user.c). Can we not stick to standard functions? Instead of htobe32() we should use htonl() which is available both in U-Boot and in the host environment. 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 While money can't buy happiness, it certainly lets you choose your own form of misery. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot