mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
FS #8635 by Andree Buschmann: Fix overflow in test_disk speed calculation. No precision is lost because filesize is always a multiple of (1<<8).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16428 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
97d7f39680
commit
3a74611a90
1 changed files with 3 additions and 3 deletions
|
@ -232,7 +232,7 @@ static bool file_speed(int chunksize, bool align)
|
|||
time = *rb->current_tick - time;
|
||||
rb->close(fd);
|
||||
rb->snprintf(text_buf, sizeof text_buf, "Create (%d,%c): %ld KB/s",
|
||||
chunksize, align ? 'A' : 'U', (25 * filesize / time) >> 8);
|
||||
chunksize, align ? 'A' : 'U', (25 * (filesize>>8) / time) );
|
||||
log_text(text_buf, true);
|
||||
|
||||
/* Existing file write speed */
|
||||
|
@ -255,7 +255,7 @@ static bool file_speed(int chunksize, bool align)
|
|||
time = *rb->current_tick - time;
|
||||
rb->close(fd);
|
||||
rb->snprintf(text_buf, sizeof text_buf, "Write (%d,%c): %ld KB/s",
|
||||
chunksize, align ? 'A' : 'U', (25 * filesize / time) >> 8);
|
||||
chunksize, align ? 'A' : 'U', (25 * (filesize>>8) / time) );
|
||||
log_text(text_buf, true);
|
||||
|
||||
/* File read speed */
|
||||
|
@ -278,7 +278,7 @@ static bool file_speed(int chunksize, bool align)
|
|||
time = *rb->current_tick - time;
|
||||
rb->close(fd);
|
||||
rb->snprintf(text_buf, sizeof text_buf, "Read (%d,%c): %ld KB/s",
|
||||
chunksize, align ? 'A' : 'U', (25 * filesize / time) >> 8);
|
||||
chunksize, align ? 'A' : 'U', (25 * (filesize>>8) / time) );
|
||||
log_text(text_buf, true);
|
||||
rb->remove(TEST_FILE);
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue