[U-Boot] [PATCH V2] console: Implement pre-console buffer

Wolfgang Denk wd at denx.de
Tue Aug 30 22:08:17 CEST 2011


Dear Mike Frysinger,

In message <201108301558.08010.vapier at 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

-- 
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
"Maintain an awareness for contribution --  to  your  schedule,  your
project, our company."                         - A Group of Employees


More information about the U-Boot mailing list