avoid arithmetic overflow in the examples/file/readspeed.c and writespeed.c
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1916 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
c53d3be4e1
commit
d21b20835f
|
@ -55,7 +55,7 @@ void readspeed(const char* filename, int block_size)
|
||||||
rt_free(buff_ptr);
|
rt_free(buff_ptr);
|
||||||
|
|
||||||
/* calculate read speed */
|
/* calculate read speed */
|
||||||
rt_kprintf("File read speed: %d byte/s\n", total_length*RT_TICK_PER_SECOND/tick);
|
rt_kprintf("File read speed: %d byte/s\n", total_length /tick * RT_TICK_PER_SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RT_USING_FINSH
|
#ifdef RT_USING_FINSH
|
||||||
|
|
|
@ -63,7 +63,7 @@ void writespeed(const char* filename, int total_length, int block_size)
|
||||||
rt_free(buff_ptr);
|
rt_free(buff_ptr);
|
||||||
|
|
||||||
/* calculate write speed */
|
/* calculate write speed */
|
||||||
rt_kprintf("File write speed: %d byte/s\n", total_length*RT_TICK_PER_SECOND/tick);
|
rt_kprintf("File write speed: %d byte/s\n", total_length / tick * RT_TICK_PER_SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RT_USING_FINSH
|
#ifdef RT_USING_FINSH
|
||||||
|
|
Loading…
Reference in New Issue