public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Bug in StrataFlash drivers
Date: Mon, 21 Nov 2005 21:40:42 +0100	[thread overview]
Message-ID: <m2fyppg2et.fsf@sowhat.denx.de> (raw)
In-Reply-To: <4374BD2F.5060608@dave-tech.it> (r&d2@dave-tech.it's message of "Fri, 11 Nov 2005 16:47:59 +0100")

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

  reply	other threads:[~2005-11-21 20:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-11 15:39 [U-Boot-Users] Bug in StrataFlash drivers Menon, Nishanth
2005-11-11 15:47 ` llandre
2005-11-21 20:40   ` Detlev Zundel [this message]
     [not found] <20051111093808.0F719352681@atlas.denx.de>
2005-11-11 10:26 ` llandre
2006-08-18  9:40   ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2005-11-10 14:18 llandre
2005-11-10 16:44 ` Wolfgang Denk
2005-11-11  9:29   ` llandre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2fyppg2et.fsf@sowhat.denx.de \
    --to=dzu@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox