Use integers rather than floats everywhere

We don't need floating point precision if results are casted back to
integer. Instead, rearrange operations and do the integer division after
the multiplication.

Version numbers are terminating decimals anyway and can be stored using
two integers without losing any information.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2012-07-10 02:20:04 +02:00
parent 8311f14dea
commit 8375e9a51b
4 changed files with 21 additions and 25 deletions

View File

@@ -311,9 +311,8 @@ void todo_update_panel(int which_pan)
/* Draw the scrollbar if necessary. */
if (todos > max_items) {
float ratio = ((float)max_items) / ((float)todos);
int sbar_length = (int)(ratio * (max_items + 1));
int highend = (int)(ratio * first);
int sbar_length = max_items * (max_items + 1) / todos;
int highend = max_items * first / todos;
unsigned hilt_bar = (which_pan == TOD) ? 1 : 0;
int sbar_top = highend + title_lines;