From: Paul N. Hilfinger Date: Sat, 20 Mar 2004 09:53:03 +0000 (+0000) Subject: print_percentage: Use floating point to avoid incorrect results when X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b2ba182e8f635d2d97ed07317920422cca90b4e8;p=binutils-gdb.git print_percentage: Use floating point to avoid incorrect results when portion*100 overflows. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 442af68deab..53824f1d941 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2004-03-20 Paul Hilfinger + + * bcache.c (print_percentage): Use floating point to avoid + incorrect results when portion*100 overflows. + 2004-03-19 Kevin Buettner * ppc_tdep.h (ppc_linux_frame_saved_pc) diff --git a/gdb/bcache.c b/gdb/bcache.c index cadadb5cce6..0bc533ebfef 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -303,7 +303,7 @@ print_percentage (int portion, int total) if (total == 0) printf_filtered ("(not applicable)\n"); else - printf_filtered ("%3d%%\n", portion * 100 / total); + printf_filtered ("%3d%%\n", (int) (portion * 100.0 / total)); }