[BranchProbability] Manually round the floating point output.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 26 Sep 2015 10:09:36 +0000 (10:09 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 26 Sep 2015 10:09:36 +0000 (10:09 +0000)
commit68dc5fad79c52dcbcbb2f28b142c661fd9945276
treea73a72f12fb67fb1cda22c107f6d51c570694f20
parent5775e77c0c225d8d8bf4b8e8d56da31a1f77422b
[BranchProbability] Manually round the floating point output.

llvm::format compiles down to snprintf which has no defined rounding for
floating point arguments, and MSVC has implemented it differently from
what the BSD libcs and glibc do. Try to emulate the glibc rounding
behavior to avoid changing tests.

While there simplify code a bit and move trivial methods inline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248665 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/BranchProbability.h
lib/Support/BranchProbability.cpp