From mboxrd@z Thu Jan 1 00:00:00 1970 From: Detlev Zundel Date: Mon, 21 Nov 2005 21:40:42 +0100 Subject: [U-Boot-Users] Bug in StrataFlash drivers In-Reply-To: <4374BD2F.5060608@dave-tech.it> (r&d2@dave-tech.it's message of "Fri, 11 Nov 2005 16:47:59 +0100") References: <520AB2AD990DC04082102F77CA17263801B540A3@dlee03.ent.ti.com> <4374BD2F.5060608@dave-tech.it> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, > Hello, > >> I can see it hit here too: >> case FLASH_CFI_32BIT: >> cnt = len >> 2; >> break; >> default: >> it is a div 4operation.. so last 3 bytes may go missin!! >> Mebbe I am wrong abt it.. but then.. so it seems.. I guess code like this should read like cnt = len + (2^n-1) >> n; For the two cases in question (n=1) cnt = len + 1 >> 1; and (n=2) cnt = len + 3 >> 2; This avoids the branch. Cheers Detlev -- Modern methods of production have given us the possibility of ease and security for all; we have chosen, instead, to have overwork for some and starvation for others. -- Bertrand Russell