1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Define a hexfloat literal emulator since we can't depend on being able to
11 // for hexfloat literals
13 // 0x10.F5p-10 == hexfloat<double>(0x10, 0xF5, -10)
27 hexfloat(long long m1
, unsigned long long m0
, int exp
)
29 const std::size_t n
= sizeof(unsigned long long) * CHAR_BIT
;
30 int s
= m1
< 0 ? -1 : 1;
31 value_
= std::ldexp(m1
+ s
* std::ldexp(T(m0
), -static_cast<int>(n
-
32 std::__clz(m0
)/4*4)), exp
);
35 operator T() const {return value_
;}