Fix minor style issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99414 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-03-24 19:38:02 +00:00
parent 34b96f4fb3
commit 16e02097d2
6 changed files with 206 additions and 211 deletions

View File

@ -116,8 +116,8 @@ hexDigitValue(unsigned int c)
static inline void static inline void
assertArithmeticOK(const llvm::fltSemantics &semantics) { assertArithmeticOK(const llvm::fltSemantics &semantics) {
assert(semantics.arithmeticOK assert(semantics.arithmeticOK &&
&& "Compile-time arithmetic does not support these semantics"); "Compile-time arithmetic does not support these semantics");
} }
/* Return the value of a decimal exponent of the form /* Return the value of a decimal exponent of the form
@ -360,8 +360,8 @@ lostFractionThroughTruncation(const integerPart *parts,
return lfExactlyZero; return lfExactlyZero;
if (bits == lsb + 1) if (bits == lsb + 1)
return lfExactlyHalf; return lfExactlyHalf;
if(bits <= partCount * integerPartWidth if (bits <= partCount * integerPartWidth &&
&& APInt::tcExtractBit(parts, bits - 1)) APInt::tcExtractBit(parts, bits - 1))
return lfMoreThanHalf; return lfMoreThanHalf;
return lfLessThanHalf; return lfLessThanHalf;
@ -905,8 +905,7 @@ APFloat::multiplySignificand(const APFloat &rhs, const APFloat *addend)
/* Normalize our MSB. */ /* Normalize our MSB. */
extendedPrecision = precision + precision - 1; extendedPrecision = precision + precision - 1;
if(omsb != extendedPrecision) if (omsb != extendedPrecision) {
{
APInt::tcShiftLeft(fullSignificand, newPartsCount, APInt::tcShiftLeft(fullSignificand, newPartsCount,
extendedPrecision - omsb); extendedPrecision - omsb);
exponent -= extendedPrecision - omsb; exponent -= extendedPrecision - omsb;
@ -1113,11 +1112,10 @@ APFloat::opStatus
APFloat::handleOverflow(roundingMode rounding_mode) APFloat::handleOverflow(roundingMode rounding_mode)
{ {
/* Infinity? */ /* Infinity? */
if(rounding_mode == rmNearestTiesToEven if (rounding_mode == rmNearestTiesToEven ||
|| rounding_mode == rmNearestTiesToAway rounding_mode == rmNearestTiesToAway ||
|| (rounding_mode == rmTowardPositive && !sign) (rounding_mode == rmTowardPositive && !sign) ||
|| (rounding_mode == rmTowardNegative && sign)) (rounding_mode == rmTowardNegative && sign)) {
{
category = fcInfinity; category = fcInfinity;
return (opStatus) (opOverflow | opInexact); return (opStatus) (opOverflow | opInexact);
} }
@ -1730,9 +1728,9 @@ APFloat::fusedMultiplyAdd(const APFloat &multiplicand,
/* If and only if all arguments are normal do we need to do an /* If and only if all arguments are normal do we need to do an
extended-precision calculation. */ extended-precision calculation. */
if(category == fcNormal if (category == fcNormal &&
&& multiplicand.category == fcNormal multiplicand.category == fcNormal &&
&& addend.category == fcNormal) { addend.category == fcNormal) {
lostFraction lost_fraction; lostFraction lost_fraction;
lost_fraction = multiplySignificand(multiplicand, &addend); lost_fraction = multiplySignificand(multiplicand, &addend);
@ -2004,8 +2002,8 @@ APFloat::convertToSignExtendedInteger(integerPart *parts, unsigned int width,
if (truncatedBits) { if (truncatedBits) {
lost_fraction = lostFractionThroughTruncation(src, partCount(), lost_fraction = lostFractionThroughTruncation(src, partCount(),
truncatedBits); truncatedBits);
if (lost_fraction != lfExactlyZero if (lost_fraction != lfExactlyZero &&
&& roundAwayFromZero(rounding_mode, lost_fraction, truncatedBits)) { roundAwayFromZero(rounding_mode, lost_fraction, truncatedBits)) {
if (APInt::tcIncrement(parts, dstPartsCount)) if (APInt::tcIncrement(parts, dstPartsCount))
return opInvalidOp; /* Overflow. */ return opInvalidOp; /* Overflow. */
} }
@ -2149,8 +2147,8 @@ APFloat::convertFromSignExtendedInteger(const integerPart *src,
opStatus status; opStatus status;
assertArithmeticOK(*semantics); assertArithmeticOK(*semantics);
if (isSigned if (isSigned &&
&& APInt::tcExtractBit(src, srcCount * integerPartWidth - 1)) { APInt::tcExtractBit(src, srcCount * integerPartWidth - 1)) {
integerPart *copy; integerPart *copy;
/* If we're signed and negative negate a copy. */ /* If we're signed and negative negate a copy. */
@ -2287,8 +2285,8 @@ APFloat::roundSignificandWithExponent(const integerPart *decSigParts,
integerPart pow5Parts[maxPowerOfFiveParts]; integerPart pow5Parts[maxPowerOfFiveParts];
bool isNearest; bool isNearest;
isNearest = (rounding_mode == rmNearestTiesToEven isNearest = (rounding_mode == rmNearestTiesToEven ||
|| rounding_mode == rmNearestTiesToAway); rounding_mode == rmNearestTiesToAway);
parts = partCountForBits(semantics->precision + 11); parts = partCountForBits(semantics->precision + 11);
@ -3217,8 +3215,8 @@ APFloat APFloat::getLargest(const fltSemantics &Sem, bool Negative) {
significand[i] = ~((integerPart) 0); significand[i] = ~((integerPart) 0);
// ...and then clear the top bits for internal consistency. // ...and then clear the top bits for internal consistency.
significand[N-1] significand[N-1] &=
&= (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1)) - 1; (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1)) - 1;
return Val; return Val;
} }
@ -3247,8 +3245,8 @@ APFloat APFloat::getSmallestNormalized(const fltSemantics &Sem, bool Negative) {
Val.exponent = Sem.minExponent; Val.exponent = Sem.minExponent;
Val.zeroSignificand(); Val.zeroSignificand();
Val.significandParts()[partCountForBits(Sem.precision)-1] Val.significandParts()[partCountForBits(Sem.precision)-1] |=
|= (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1)); (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1));
return Val; return Val;
} }

View File

@ -702,8 +702,7 @@ static inline uint32_t hashword(const uint64_t *k64, size_t length)
a = b = c = 0xdeadbeef + (((uint32_t)length)<<2); a = b = c = 0xdeadbeef + (((uint32_t)length)<<2);
/*------------------------------------------------- handle most of the key */ /*------------------------------------------------- handle most of the key */
while (length > 3) while (length > 3) {
{
a += k[0]; a += k[0];
b += k[1]; b += k[1];
c += k[2]; c += k[2];
@ -2065,8 +2064,8 @@ void APInt::fromString(unsigned numbits, const StringRef& str, uint8_t radix) {
assert((slen <= numbits || radix != 2) && "Insufficient bit width"); assert((slen <= numbits || radix != 2) && "Insufficient bit width");
assert(((slen-1)*3 <= numbits || radix != 8) && "Insufficient bit width"); assert(((slen-1)*3 <= numbits || radix != 8) && "Insufficient bit width");
assert(((slen-1)*4 <= numbits || radix != 16) && "Insufficient bit width"); assert(((slen-1)*4 <= numbits || radix != 16) && "Insufficient bit width");
assert((((slen-1)*64)/22 <= numbits || radix != 10) assert((((slen-1)*64)/22 <= numbits || radix != 10) &&
&& "Insufficient bit width"); "Insufficient bit width");
// Allocate memory // Allocate memory
if (!isSingleWord()) if (!isSingleWord())
@ -2340,8 +2339,8 @@ APInt::tcIsZero(const integerPart *src, unsigned int parts)
int int
APInt::tcExtractBit(const integerPart *parts, unsigned int bit) APInt::tcExtractBit(const integerPart *parts, unsigned int bit)
{ {
return(parts[bit / integerPartWidth] return (parts[bit / integerPartWidth] &
& ((integerPart) 1 << bit % integerPartWidth)) != 0; ((integerPart) 1 << bit % integerPartWidth)) != 0;
} }
/* Set the given bit of a bignum. */ /* Set the given bit of a bignum. */

View File

@ -676,8 +676,8 @@ void cl::ParseCommandLineOptions(int argc, char **argv,
<< " positional arguments: See: " << argv[0] << " -help\n"; << " positional arguments: See: " << argv[0] << " -help\n";
ErrorParsing = true; ErrorParsing = true;
} else if (!HasUnlimitedPositionals } else if (!HasUnlimitedPositionals &&
&& PositionalVals.size() > PositionalOpts.size()) { PositionalVals.size() > PositionalOpts.size()) {
errs() << ProgramName errs() << ProgramName
<< ": Too many positional arguments specified!\n" << ": Too many positional arguments specified!\n"
<< "Can specify at most " << PositionalOpts.size() << "Can specify at most " << PositionalOpts.size()

View File

@ -64,8 +64,7 @@ DebugOnly("debug-only", cl::desc("Enable a specific type of debug output"),
cl::location(DebugOnlyOptLoc), cl::ValueRequired); cl::location(DebugOnlyOptLoc), cl::ValueRequired);
// Signal handlers - dump debug output on termination. // Signal handlers - dump debug output on termination.
static void debug_user_sig_handler(void *Cookie) static void debug_user_sig_handler(void *Cookie) {
{
// This is a bit sneaky. Since this is under #ifndef NDEBUG, we // This is a bit sneaky. Since this is under #ifndef NDEBUG, we
// know that debug mode is enabled and dbgs() really is a // know that debug mode is enabled and dbgs() really is a
// circular_raw_ostream. If NDEBUG is defined, then dbgs() == // circular_raw_ostream. If NDEBUG is defined, then dbgs() ==

View File

@ -71,4 +71,3 @@ void llvm_unreachable_internal(const char *msg, const char *file,
abort(); abort();
} }
} }