Correction to hexfloat hack.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131340 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d515df2a50
commit
e80c36e27b
@ -24,11 +24,12 @@ class hexfloat
|
|||||||
{
|
{
|
||||||
T value_;
|
T value_;
|
||||||
public:
|
public:
|
||||||
hexfloat(unsigned long long m1, unsigned long long m0, int exp)
|
hexfloat(long long m1, unsigned long long m0, int exp)
|
||||||
{
|
{
|
||||||
const std::size_t n = sizeof(unsigned long long) * CHAR_BIT;
|
const std::size_t n = sizeof(unsigned long long) * CHAR_BIT;
|
||||||
value_ = std::ldexp(m1 + std::ldexp(T(m0), -static_cast<int>(n -
|
int s = m1 < 0 ? -1 : 1;
|
||||||
std::__clz(m0))), exp);
|
value_ = std::ldexp(m1 + s * std::ldexp(T(m0), -static_cast<int>(n -
|
||||||
|
std::__clz(m0)/4*4)), exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
operator T() const {return value_;}
|
operator T() const {return value_;}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user