diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2010-04-19 16:40:08 +0800 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-05-16 13:39:47 +0200 |
commit | 89747f81f22084b255f35d92f709facd3b4553a1 (patch) | |
tree | 1e07321c3cdc94cd48d6e3deb5a1c00b6713c257 /src/helper/log.h | |
parent | c7b269ace1bbe07d5db7a562bb9242f4be32be67 (diff) | |
download | openocd+libswd-89747f81f22084b255f35d92f709facd3b4553a1.tar.gz openocd+libswd-89747f81f22084b255f35d92f709facd3b4553a1.tar.bz2 openocd+libswd-89747f81f22084b255f35d92f709facd3b4553a1.tar.xz openocd+libswd-89747f81f22084b255f35d92f709facd3b4553a1.zip |
NOR/CFI: simplify bufferwsize computation
Review and simplify computation of bufferwsize.
Add comments about variables' meaning.
The same code is present 3 times in the file.
Current patch updates all the 3 instances.
Step 1)
Replace "switch(bank->chip_width) {...}".
Illegal values of bank->chip_width are already dropped.
For legal values, the code is equivalent to:
bufferwsize = buffersize / bank->chip_width;
Step 2)
The above code replacement plus the following line:
bufferwsize /= (bank->bus_width / bank->chip_width);
is merged in a single formula:
bufferwsize = (buffersize / bank->chip_width) /
(bank->bus_width / bank->chip_width);
and simplified as:
bufferwsize = buffersize / bank->bus_width;
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src/helper/log.h')
0 files changed, 0 insertions, 0 deletions