// Test if the significand excluding the integral bit is all ones. This allows

776

// us to test for binade boundaries.

777

const integerPart *Parts = significandParts();

778

constunsigned PartCount = partCount();

779

for (unsigned i = 0; i < PartCount - 1; i++)

780

if (~Parts[i])

781

returnfalse;

782

783

// Set the unused high bits to all ones when we compare.

784

constunsigned NumHighBits =

785

PartCount*integerPartWidth - semantics->precision + 1;

786

assert(NumHighBits <= integerPartWidth && "Can not have more high bits to "((NumHighBits <= integerPartWidth && "Can not have more high bits to " "fill than integerPartWidth") ? static_cast<void> (0) : __assert_fail ("NumHighBits <= integerPartWidth && \"Can not have more high bits to \" \"fill than integerPartWidth\"", "/build/llvm-toolchain-snapshot-8~svn350071/lib/Support/APFloat.cpp", 787, __PRETTY_FUNCTION__))

787

"fill than integerPartWidth")((NumHighBits <= integerPartWidth && "Can not have more high bits to " "fill than integerPartWidth") ? static_cast<void> (0) : __assert_fail ("NumHighBits <= integerPartWidth && \"Can not have more high bits to \" \"fill than integerPartWidth\"", "/build/llvm-toolchain-snapshot-8~svn350071/lib/Support/APFloat.cpp", 787, __PRETTY_FUNCTION__));

788

const integerPart HighBitFill =

789

~integerPart(0) << (integerPartWidth - NumHighBits);

790

if (~(Parts[PartCount - 1] | HighBitFill))

791

returnfalse;

792

793

returntrue;

794

}

795

796

bool IEEEFloat::isSignificandAllZeros() const {

797

// Test if the significand excluding the integral bit is all zeros. This

798

// allows us to test for binade boundaries.

799

const integerPart *Parts = significandParts();

800

constunsigned PartCount = partCount();

801

802

for (unsigned i = 0; i < PartCount - 1; i++)

803

if (Parts[i])

804

returnfalse;

805

806

constunsigned NumHighBits =

807

PartCount*integerPartWidth - semantics->precision + 1;

808

assert(NumHighBits <= integerPartWidth && "Can not have more high bits to "((NumHighBits <= integerPartWidth && "Can not have more high bits to " "clear than integerPartWidth") ? static_cast<void> (0) : __assert_fail ("NumHighBits <= integerPartWidth && \"Can not have more high bits to \" \"clear than integerPartWidth\"", "/build/llvm-toolchain-snapshot-8~svn350071/lib/Support/APFloat.cpp", 809, __PRETTY_FUNCTION__))

809

"clear than integerPartWidth")((NumHighBits <= integerPartWidth && "Can not have more high bits to " "clear than integerPartWidth") ? static_cast<void> (0) : __assert_fail ("NumHighBits <= integerPartWidth && \"Can not have more high bits to \" \"clear than integerPartWidth\"", "/build/llvm-toolchain-snapshot-8~svn350071/lib/Support/APFloat.cpp", 809, __PRETTY_FUNCTION__));

810

const integerPart HighBitMask = ~integerPart(0) >> NumHighBits;

811

812

if (Parts[PartCount - 1] & HighBitMask)

813

returnfalse;

814

815

returntrue;

816

}

817

818

bool IEEEFloat::isLargest() const {

819

// The largest number by magnitude in our format will be the floating point

820

// number with maximum exponent and with significand that is all ones.

821

return isFiniteNonZero() && exponent == semantics->maxExponent

822

&& isSignificandAllOnes();

823

}

824

825

bool IEEEFloat::isInteger() const {

826

// This could be made more efficient; I'm going for obviously correct.

assert(exponent != semantics->maxExponent &&((exponent != semantics->maxExponent && "We can not increment an exponent beyond the maxExponent allowed" " by the given floating point semantics.") ? static_cast<void> (0) : __assert_fail ("exponent != semantics->maxExponent && \"We can not increment an exponent beyond the maxExponent allowed\" \" by the given floating point semantics.\"", "/build/llvm-toolchain-snapshot-8~svn350071/lib/Support/APFloat.cpp", 3754, __PRETTY_FUNCTION__))

3753

"We can not increment an exponent beyond the maxExponent allowed"((exponent != semantics->maxExponent && "We can not increment an exponent beyond the maxExponent allowed" " by the given floating point semantics.") ? static_cast<void> (0) : __assert_fail ("exponent != semantics->maxExponent && \"We can not increment an exponent beyond the maxExponent allowed\" \" by the given floating point semantics.\"", "/build/llvm-toolchain-snapshot-8~svn350071/lib/Support/APFloat.cpp", 3754, __PRETTY_FUNCTION__))

3754

" by the given floating point semantics.")((exponent != semantics->maxExponent && "We can not increment an exponent beyond the maxExponent allowed" " by the given floating point semantics.") ? static_cast<void> (0) : __assert_fail ("exponent != semantics->maxExponent && \"We can not increment an exponent beyond the maxExponent allowed\" \" by the given floating point semantics.\"", "/build/llvm-toolchain-snapshot-8~svn350071/lib/Support/APFloat.cpp", 3754, __PRETTY_FUNCTION__));