
21 Nov
2005
21 Nov
'05
9:40 p.m.
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