mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-28 08:02:08 +00:00
[libc] add EXP_MAT_MASK to x87 long double
A previous patch added the constant EXP_MANT_MASK to the FloatProperties for other types of long double. This patch adds it to the special 80-bit x87 long double. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D127550
This commit is contained in:
parent
7e7021ca1a
commit
02f4affe2d
@ -109,16 +109,27 @@ template <> struct FloatProperties<long double> {
|
||||
"Unexpected size of 'long double' type.");
|
||||
|
||||
static constexpr uint32_t BIT_WIDTH = (sizeof(BitsType) * 8) - 48;
|
||||
static constexpr BitsType FULL_WIDTH_MASK = ((BitsType(1) << BIT_WIDTH) - 1);
|
||||
|
||||
static constexpr uint32_t MANTISSA_WIDTH = 63;
|
||||
static constexpr uint32_t EXPONENT_WIDTH = 15;
|
||||
static constexpr BitsType MANTISSA_MASK = (BitsType(1) << MANTISSA_WIDTH) - 1;
|
||||
|
||||
// The x86 80 bit float represents the leading digit of the mantissa
|
||||
// explicitly. This is the mask for that bit.
|
||||
static constexpr BitsType EXPLICIT_BIT_MASK = (BitsType(1) << MANTISSA_WIDTH);
|
||||
|
||||
static constexpr BitsType SIGN_MASK =
|
||||
BitsType(1) << (EXPONENT_WIDTH + MANTISSA_WIDTH + 1);
|
||||
static constexpr BitsType EXPONENT_MASK =
|
||||
((BitsType(1) << EXPONENT_WIDTH) - 1) << (MANTISSA_WIDTH + 1);
|
||||
static constexpr uint32_t EXPONENT_BIAS = 16383;
|
||||
|
||||
static constexpr BitsType EXP_MANT_MASK =
|
||||
MANTISSA_MASK + EXPLICIT_BIT_MASK + EXPONENT_MASK;
|
||||
static_assert(EXP_MANT_MASK == (~SIGN_MASK & FULL_WIDTH_MASK),
|
||||
"Exponent and mantissa masks are not as expected.");
|
||||
|
||||
// If a number x is a NAN, then it is a quiet NAN if:
|
||||
// QuietNaNMask & bits(x) != 0
|
||||
// Else, it is a signalling NAN.
|
||||
|
Loading…
Reference in New Issue
Block a user