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:
dzzxzz@gmail.com 2012-01-11 11:19:41 +00:00
parent c53d3be4e1
commit d21b20835f
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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