diff options
author | Rafael Lee <rafaellee.img@gmail.com> | 2022-04-13 04:50:38 +0800 |
---|---|---|
committer | Rafael Lee <rafaellee.img@gmail.com> | 2022-04-13 04:51:46 +0800 |
commit | 848f6a874e3ef24dabf5f9267a725bb974cfea01 (patch) | |
tree | 8c518a5120f1edf1a6015c040e3e87c96f2668c1 /iceprog | |
parent | 9f66f9ce16941c6417813cb87653c735a78b53ae (diff) | |
download | icestorm-848f6a874e3ef24dabf5f9267a725bb974cfea01.tar.gz icestorm-848f6a874e3ef24dabf5f9267a725bb974cfea01.tar.bz2 icestorm-848f6a874e3ef24dabf5f9267a725bb974cfea01.zip |
Fix float exception when value is less than 100
Signed-off-by: Rafael Lee <rafaellee.img@gmail.com>
Diffstat (limited to 'iceprog')
-rw-r--r-- | iceprog/iceprog.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c index 20b05a4..f80a432 100644 --- a/iceprog/iceprog.c +++ b/iceprog/iceprog.c @@ -967,7 +967,7 @@ int main(int argc, char **argv) if (rc <= 0) break; fprintf(stderr, " \r"); - fprintf(stderr, "addr 0x%06X %3ld%%\r", rw_offset + addr, addr / (file_size / 100)); + fprintf(stderr, "addr 0x%06X %3ld%%\r", rw_offset + addr, 100 * addr / file_size); flash_write_enable(); flash_prog(rw_offset + addr, buffer, rc); flash_wait(); @@ -989,7 +989,7 @@ int main(int argc, char **argv) for (int addr = 0; addr < read_size; addr += 256) { uint8_t buffer[256]; fprintf(stderr, " \r"); - fprintf(stderr, "addr 0x%06X %3d%%\r", rw_offset + addr, addr / (read_size / 100)); + fprintf(stderr, "addr 0x%06X %3d%%\r", rw_offset + addr, 100 * addr / read_size); flash_read(rw_offset + addr, buffer, 256); fwrite(buffer, read_size - addr > 256 ? 256 : read_size - addr, 1, f); } @@ -1003,7 +1003,7 @@ int main(int argc, char **argv) if (rc <= 0) break; fprintf(stderr, " \r"); - fprintf(stderr, "addr 0x%06X %3ld%%\r", rw_offset + addr, addr / (file_size / 100)); + fprintf(stderr, "addr 0x%06X %3ld%%\r", rw_offset + addr, 100 * addr / file_size); flash_read(rw_offset + addr, buffer_flash, rc); if (memcmp(buffer_file, buffer_flash, rc)) { fprintf(stderr, "Found difference between flash and file!\n"); |