aboutsummaryrefslogtreecommitdiff
path: root/tests/test-coroutine.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-12-02 12:05:46 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2015-01-13 13:43:29 +0000
commit6d86ae0824bdd6175dd3874688a871e981093888 (patch)
treedac6f0cd324f9adcc3485eccfb7f55b84b0f0747 /tests/test-coroutine.c
parentef57137f1b30545a477ab798d34a669b0abf5320 (diff)
test-coroutine: avoid overflow on 32-bit systems
unsigned long is not large enough to represent 1000000000 * duration there. Just use floating point. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1417518350-6167-4-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/test-coroutine.c')
-rw-r--r--tests/test-coroutine.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c
index e22fae170a..27d1b6f8e8 100644
--- a/tests/test-coroutine.c
+++ b/tests/test-coroutine.c
@@ -337,7 +337,7 @@ static void perf_cost(void)
"%luns per coroutine",
maxcycles,
duration, ops,
- (unsigned long)(1000000000 * duration) / maxcycles);
+ (unsigned long)(1000000000.0 * duration / maxcycles));
}
int main(int argc, char **argv)