
Dear Mike Frysinger,
In message 201108301558.08010.vapier@gentoo.org you wrote:
Please see my previous posting (http://article.gmane.org/gmane.comp.boot-loaders.u-boot/106810)
I don't think 3 additional addembler instructions really play a big role here.
i'm pretty sure if you define CONFIG_PRE_CON_BUF_SZ as a power of 2 value, you get nice & simple assembly code. so if the generated code is undesirable, pick a CONFIG value that is power-of-2 ?
This was the test code I compiled:
--------------------------------------------- #define CONFIG_SYS_TMP_CON_BUF_SZ 1024
int foo(int i) { return i & (CONFIG_SYS_TMP_CON_BUF_SZ-1); }
int bar(int i) { return i % CONFIG_SYS_TMP_CON_BUF_SZ; } ---------------------------------------------
So was actually checking for a power-of-2 value.
Best regards,
Wolfgang Denk