提交 6d86ae08 编写于 作者: P Paolo Bonzini 提交者: Stefan Hajnoczi

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: NPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: NFam Zheng <famz@redhat.com>
Message-id: 1417518350-6167-4-git-send-email-pbonzini@redhat.com
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 ef57137f
...@@ -337,7 +337,7 @@ static void perf_cost(void) ...@@ -337,7 +337,7 @@ static void perf_cost(void)
"%luns per coroutine", "%luns per coroutine",
maxcycles, maxcycles,
duration, ops, duration, ops,
(unsigned long)(1000000000 * duration) / maxcycles); (unsigned long)(1000000000.0 * duration / maxcycles));
} }
int main(int argc, char **argv) int main(int argc, char **argv)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册