From: Matthew Dillon Date: Fri, 11 Jul 2003 23:33:24 +0000 (+0000) Subject: Fix overflow in delta percentage calculation due to the fact that our 32 bit X-Git-Tag: v2.0.1~13300 X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/bf850417fc0b50e43db46b2aca5880642e780e7e Fix overflow in delta percentage calculation due to the fact that our 32 bit cp_time[] counters are now in microseconds. --- diff --git a/contrib/top/utils.c b/contrib/top/utils.c index 04a2d35c21..ab0a33db5e 100644 --- a/contrib/top/utils.c +++ b/contrib/top/utils.c @@ -9,7 +9,7 @@ * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University * * $FreeBSD: src/contrib/top/utils.c,v 1.3.6.1 2002/08/11 17:09:25 dwmalone Exp $ - * $DragonFly: src/contrib/top/utils.c,v 1.2 2003/06/17 04:24:07 dillon Exp $ + * $DragonFly: src/contrib/top/utils.c,v 1.3 2003/07/11 23:33:24 dillon Exp $ */ /* @@ -316,7 +316,7 @@ long *diffs; if(total_change) { for (i = 0; i < cnt; i++) { - *out++ = (int)((*diffs++ * 1000 + half_total) / total_change); + *out++ = (int)((*diffs++ * 1000LL + half_total) / total_change); } }