From mboxrd@z Thu Jan 1 00:00:00 1970 From: Graeme Russ Date: Tue, 30 Aug 2011 19:37:49 +1000 Subject: [U-Boot] [RFC PATCH] Pre-console buffer for ARM In-Reply-To: <20110830092934.24BF118C46FC@gemini.denx.de> References: <1314638517-20178-1-git-send-email-sjg@chromium.org> <201108291610.31528.vapier@gentoo.org> <201108292132.32574.vapier@gentoo.org> <20110830051710.225A118C46FC@gemini.denx.de> <20110830092934.24BF118C46FC@gemini.denx.de> Message-ID: <4E5CAF6D.5070905@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Wolfgang, On 30/08/11 19:29, Wolfgang Denk wrote: > Dear Graeme Russ, > > In message 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. And it's only hit during printf() before console is initialised :) Respinning now Regards, Graeme