[U-Boot] [RFC PATCH] Pre-console buffer for ARM

Wolfgang Denk wd at denx.de
Tue Aug 30 11:29:34 CEST 2011


Dear Graeme Russ,

In message <CALButC+t=OUL9XgQnfyAdZmgPJRp7mdRwEE9LKogYHEg1D+m4g at mail.gmail.com> you wrote:
> 
> > If you want to support arbitrary buffer sizes, then just use
> >
> >        #define CIRC_BUF_IDX(idx) ((idx) % CONFIG_SYS_TMP_CON_BUF_SZ)
> 
> I know, but I was concerned that you wouldn't like the use of modulo
> arithmetic for every putc() - But I suppose thats cheaper than a compare
> plus branch...

Well, the difference of "i & (CONFIG_SYS_TMP_CON_BUF_SZ-1)" versus
"i % CONFIG_SYS_TMP_CON_BUF_SZ" is 1 versus 4 assembler instructions
on Power, and 2 versus 5 assembler instructions on ARM.  I think we
can tolerate this.

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
You get a wonderful view from the point of no return.
                                    - Terry Pratchett, _Making_Money_


More information about the U-Boot mailing list