*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Parts of this file were imported from Jens Axboe's blktrace sources (also GPL)
*/
/* Round to power of 10 */
step = exp(floor(log(step) / log10) * log10);
/* Scale down step to provide enough ticks */
- while ((last - first) / (step * mini_step[cur_mini_step]) > num_ticks
- && cur_mini_step < TICK_MINI_STEPS)
+ while (cur_mini_step < TICK_MINI_STEPS
+ && (last - first) / (step * mini_step[cur_mini_step]) > num_ticks)
cur_mini_step++;
- step *= mini_step[cur_mini_step - 1];
+
+ if (cur_mini_step > 0)
+ step *= mini_step[cur_mini_step - 1];
return step;
}