Ignore:
Timestamp:
Apr 19, 2011, 11:12:07 PM (14 years ago)
Author:
Yuri Dario
Message:

clamav: update trunk to 0.97.

Location:
clamav/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • clamav/trunk

  • TabularUnified clamav/trunk/libclamav/c++/llvm/lib/Support/APFloat.cpp

    r189 r319  
    6666
    6767       power * 815 / (351 * integerPartWidth) + 1
    68        
     68
    6969     However, whilst the result may require only this many parts,
    7070     because we are multiplying two values to get it, the
     
    101101
    102102  r = c - '0';
    103   if(r <= 9)
     103  if (r <= 9)
    104104    return r;
    105105
    106106  r = c - 'A';
    107   if(r <= 5)
     107  if (r <= 5)
    108108    return r + 10;
    109109
    110110  r = c - 'a';
    111   if(r <= 5)
     111  if (r <= 5)
    112112    return r + 10;
    113113
     
    117117static inline void
    118118assertArithmeticOK(const llvm::fltSemantics &semantics) {
    119   assert(semantics.arithmeticOK
    120          && "Compile-time arithmetic does not support these semantics");
     119  assert(semantics.arithmeticOK &&
     120         "Compile-time arithmetic does not support these semantics");
    121121}
    122122
     
    154154    if (absExponent >= overlargeExponent) {
    155155      absExponent = overlargeExponent;
     156      p = end;  /* outwit assert below */
    156157      break;
    157158    }
     
    180181
    181182  negative = *p == '-';
    182   if(*p == '-' || *p == '+') {
     183  if (*p == '-' || *p == '+') {
    183184    p++;
    184185    assert(p != end && "Exponent has no digits");
     
    187188  unsignedExponent = 0;
    188189  overflow = false;
    189   for(; p != end; ++p) {
     190  for (; p != end; ++p) {
    190191    unsigned int value;
    191192
     
    194195
    195196    unsignedExponent = unsignedExponent * 10 + value;
    196     if(unsignedExponent > 65535)
     197    if (unsignedExponent > 65535)
    197198      overflow = true;
    198199  }
    199200
    200   if(exponentAdjustment > 65535 || exponentAdjustment < -65536)
     201  if (exponentAdjustment > 65535 || exponentAdjustment < -65536)
    201202    overflow = true;
    202203
    203   if(!overflow) {
     204  if (!overflow) {
    204205    exponent = unsignedExponent;
    205     if(negative)
     206    if (negative)
    206207      exponent = -exponent;
    207208    exponent += exponentAdjustment;
    208     if(exponent > 65535 || exponent < -65536)
     209    if (exponent > 65535 || exponent < -65536)
    209210      overflow = true;
    210211  }
    211212
    212   if(overflow)
     213  if (overflow)
    213214    exponent = negative ? -65536: 65535;
    214215
     
    222223  StringRef::iterator p = begin;
    223224  *dot = end;
    224   while(*p == '0' && p != end)
     225  while (*p == '0' && p != end)
    225226    p++;
    226227
    227   if(*p == '.') {
     228  if (*p == '.') {
    228229    *dot = p++;
    229230
    230231    assert(end - begin != 1 && "Significand has no digits");
    231232
    232     while(*p == '0' && p != end)
     233    while (*p == '0' && p != end)
    233234      p++;
    234235  }
     
    324325  /* If the first trailing digit isn't 0 or 8 we can work out the
    325326     fraction immediately.  */
    326   if(digitValue > 8)
     327  if (digitValue > 8)
    327328    return lfMoreThanHalf;
    328   else if(digitValue < 8 && digitValue > 0)
     329  else if (digitValue < 8 && digitValue > 0)
    329330    return lfLessThanHalf;
    330331
    331332  /* Otherwise we need to find the first non-zero digit.  */
    332   while(*p == '0')
     333  while (*p == '0')
    333334    p++;
    334335
     
    339340  /* If we ran off the end it is exactly zero or one-half, otherwise
    340341     a little more.  */
    341   if(hexDigit == -1U)
     342  if (hexDigit == -1U)
    342343    return digitValue == 0 ? lfExactlyZero: lfExactlyHalf;
    343344  else
     
    357358
    358359  /* Note this is guaranteed true if bits == 0, or LSB == -1U.  */
    359   if(bits <= lsb)
     360  if (bits <= lsb)
    360361    return lfExactlyZero;
    361   if(bits == lsb + 1)
     362  if (bits == lsb + 1)
    362363    return lfExactlyHalf;
    363   if(bits <= partCount * integerPartWidth
    364      && APInt::tcExtractBit(parts, bits - 1))
     364  if (bits <= partCount * integerPartWidth &&
     365      APInt::tcExtractBit(parts, bits - 1))
    365366    return lfMoreThanHalf;
    366367
     
    386387                     lostFraction lessSignificant)
    387388{
    388   if(lessSignificant != lfExactlyZero) {
    389     if(moreSignificant == lfExactlyZero)
     389  if (lessSignificant != lfExactlyZero) {
     390    if (moreSignificant == lfExactlyZero)
    390391      moreSignificant = lfLessThanHalf;
    391     else if(moreSignificant == lfExactlyHalf)
     392    else if (moreSignificant == lfExactlyHalf)
    392393      moreSignificant = lfMoreThanHalf;
    393394  }
     
    469470  integerPart pow5s[maxPowerOfFiveParts * 2 + 5];
    470471  pow5s[0] = 78125 * 5;
    471  
     472
    472473  unsigned int partsCount[16] = { 1 };
    473474  integerPart scratch[maxPowerOfFiveParts], *p1, *p2, *pow5;
     
    589590  semantics = ourSemantics;
    590591  count = partCount();
    591   if(count > 1)
     592  if (count > 1)
    592593    significand.parts = new integerPart[count];
    593594}
     
    596597APFloat::freeSignificand()
    597598{
    598   if(partCount() > 1)
     599  if (partCount() > 1)
    599600    delete [] significand.parts;
    600601}
     
    610611  sign2 = rhs.sign2;
    611612  exponent2 = rhs.exponent2;
    612   if(category == fcNormal || category == fcNaN)
     613  if (category == fcNormal || category == fcNaN)
    613614    copySignificand(rhs);
    614615}
     
    684685APFloat::operator=(const APFloat &rhs)
    685686{
    686   if(this != &rhs) {
    687     if(semantics != rhs.semantics) {
     687  if (this != &rhs) {
     688    if (semantics != rhs.semantics) {
    688689      freeSignificand();
    689690      initialize(rhs.semantics);
     
    762763}
    763764
    764 APFloat::APFloat(const fltSemantics &ourSemantics, const StringRef& text)
     765APFloat::APFloat(const fltSemantics &ourSemantics, StringRef text)
    765766{
    766767  assertArithmeticOK(ourSemantics);
     
    882883  newPartsCount = partCountForBits(precision * 2);
    883884
    884   if(newPartsCount > 4)
     885  if (newPartsCount > 4)
    885886    fullSignificand = new integerPart[newPartsCount];
    886887  else
     
    897898  exponent += rhs.exponent;
    898899
    899   if(addend) {
     900  if (addend) {
    900901    Significand savedSignificand = significand;
    901902    const fltSemantics *savedSemantics = semantics;
     
    906907    /* Normalize our MSB.  */
    907908    extendedPrecision = precision + precision - 1;
    908     if(omsb != extendedPrecision)
    909       {
    910         APInt::tcShiftLeft(fullSignificand, newPartsCount,
    911                            extendedPrecision - omsb);
    912         exponent -= extendedPrecision - omsb;
    913       }
     909    if (omsb != extendedPrecision) {
     910      APInt::tcShiftLeft(fullSignificand, newPartsCount,
     911                         extendedPrecision - omsb);
     912      exponent -= extendedPrecision - omsb;
     913    }
    914914
    915915    /* Create new semantics.  */
     
    917917    extendedSemantics.precision = extendedPrecision;
    918918
    919     if(newPartsCount == 1)
     919    if (newPartsCount == 1)
    920920      significand.part = fullSignificand[0];
    921921    else
     
    929929
    930930    /* Restore our state.  */
    931     if(newPartsCount == 1)
     931    if (newPartsCount == 1)
    932932      fullSignificand[0] = significand.part;
    933933    significand = savedSignificand;
     
    939939  exponent -= (precision - 1);
    940940
    941   if(omsb > precision) {
     941  if (omsb > precision) {
    942942    unsigned int bits, significantParts;
    943943    lostFraction lf;
     
    952952  APInt::tcAssign(lhsSignificand, fullSignificand, partsCount);
    953953
    954   if(newPartsCount > 4)
     954  if (newPartsCount > 4)
    955955    delete [] fullSignificand;
    956956
     
    974974  partsCount = partCount();
    975975
    976   if(partsCount > 2)
     976  if (partsCount > 2)
    977977    dividend = new integerPart[partsCount * 2];
    978978  else
     
    982982
    983983  /* Copy the dividend and divisor as they will be modified in-place.  */
    984   for(i = 0; i < partsCount; i++) {
     984  for (i = 0; i < partsCount; i++) {
    985985    dividend[i] = lhsSignificand[i];
    986986    divisor[i] = rhsSignificand[i];
     
    994994  /* Normalize the divisor.  */
    995995  bit = precision - APInt::tcMSB(divisor, partsCount) - 1;
    996   if(bit) {
     996  if (bit) {
    997997    exponent += bit;
    998998    APInt::tcShiftLeft(divisor, partsCount, bit);
     
    10011001  /* Normalize the dividend.  */
    10021002  bit = precision - APInt::tcMSB(dividend, partsCount) - 1;
    1003   if(bit) {
     1003  if (bit) {
    10041004    exponent -= bit;
    10051005    APInt::tcShiftLeft(dividend, partsCount, bit);
     
    10091009     Incidentally, this means that the division loop below is
    10101010     guaranteed to set the integer bit to one.  */
    1011   if(APInt::tcCompare(dividend, divisor, partsCount) < 0) {
     1011  if (APInt::tcCompare(dividend, divisor, partsCount) < 0) {
    10121012    exponent--;
    10131013    APInt::tcShiftLeft(dividend, partsCount, 1);
     
    10161016
    10171017  /* Long division.  */
    1018   for(bit = precision; bit; bit -= 1) {
    1019     if(APInt::tcCompare(dividend, divisor, partsCount) >= 0) {
     1018  for (bit = precision; bit; bit -= 1) {
     1019    if (APInt::tcCompare(dividend, divisor, partsCount) >= 0) {
    10201020      APInt::tcSubtract(dividend, divisor, 0, partsCount);
    10211021      APInt::tcSetBit(lhsSignificand, bit - 1);
     
    10281028  int cmp = APInt::tcCompare(dividend, divisor, partsCount);
    10291029
    1030   if(cmp > 0)
     1030  if (cmp > 0)
    10311031    lost_fraction = lfMoreThanHalf;
    1032   else if(cmp == 0)
     1032  else if (cmp == 0)
    10331033    lost_fraction = lfExactlyHalf;
    1034   else if(APInt::tcIsZero(dividend, partsCount))
     1034  else if (APInt::tcIsZero(dividend, partsCount))
    10351035    lost_fraction = lfExactlyZero;
    10361036  else
    10371037    lost_fraction = lfLessThanHalf;
    10381038
    1039   if(partsCount > 2)
     1039  if (partsCount > 2)
    10401040    delete [] dividend;
    10411041
     
    10731073  assert(bits < semantics->precision);
    10741074
    1075   if(bits) {
     1075  if (bits) {
    10761076    unsigned int partsCount = partCount();
    10771077
     
    10961096  /* If exponents are equal, do an unsigned bignum comparison of the
    10971097     significands.  */
    1098   if(compare == 0)
     1098  if (compare == 0)
    10991099    compare = APInt::tcCompare(significandParts(), rhs.significandParts(),
    11001100                               partCount());
    11011101
    1102   if(compare > 0)
     1102  if (compare > 0)
    11031103    return cmpGreaterThan;
    1104   else if(compare < 0)
     1104  else if (compare < 0)
    11051105    return cmpLessThan;
    11061106  else
     
    11141114{
    11151115  /* Infinity?  */
    1116   if(rounding_mode == rmNearestTiesToEven
    1117      || rounding_mode == rmNearestTiesToAway
    1118      || (rounding_mode == rmTowardPositive && !sign)
    1119      || (rounding_mode == rmTowardNegative && sign))
    1120     {
    1121       category = fcInfinity;
    1122       return (opStatus) (opOverflow | opInexact);
    1123     }
     1116  if (rounding_mode == rmNearestTiesToEven ||
     1117      rounding_mode == rmNearestTiesToAway ||
     1118      (rounding_mode == rmTowardPositive && !sign) ||
     1119      (rounding_mode == rmTowardNegative && sign)) {
     1120    category = fcInfinity;
     1121    return (opStatus) (opOverflow | opInexact);
     1122  }
    11241123
    11251124  /* Otherwise we become the largest finite number.  */
     
    11561155
    11571156  case rmNearestTiesToEven:
    1158     if(lost_fraction == lfMoreThanHalf)
     1157    if (lost_fraction == lfMoreThanHalf)
    11591158      return true;
    11601159
    11611160    /* Our zeroes don't have a significand to test.  */
    1162     if(lost_fraction == lfExactlyHalf && category != fcZero)
     1161    if (lost_fraction == lfExactlyHalf && category != fcZero)
    11631162      return APInt::tcExtractBit(significandParts(), bit);
    11641163
     
    11831182  int exponentChange;
    11841183
    1185   if(category != fcNormal)
     1184  if (category != fcNormal)
    11861185    return opOK;
    11871186
     
    11891188  omsb = significandMSB() + 1;
    11901189
    1191   if(omsb) {
     1190  if (omsb) {
    11921191    /* OMSB is numbered from 1.  We want to place it in the integer
    11931192       bit numbered PRECISON if possible, with a compensating change in
     
    11971196    /* If the resulting exponent is too high, overflow according to
    11981197       the rounding mode.  */
    1199     if(exponent + exponentChange > semantics->maxExponent)
     1198    if (exponent + exponentChange > semantics->maxExponent)
    12001199      return handleOverflow(rounding_mode);
    12011200
    12021201    /* Subnormal numbers have exponent minExponent, and their MSB
    12031202       is forced based on that.  */
    1204     if(exponent + exponentChange < semantics->minExponent)
     1203    if (exponent + exponentChange < semantics->minExponent)
    12051204      exponentChange = semantics->minExponent - exponent;
    12061205
    12071206    /* Shifting left is easy as we don't lose precision.  */
    1208     if(exponentChange < 0) {
     1207    if (exponentChange < 0) {
    12091208      assert(lost_fraction == lfExactlyZero);
    12101209
     
    12141213    }
    12151214
    1216     if(exponentChange > 0) {
     1215    if (exponentChange > 0) {
    12171216      lostFraction lf;
    12181217
     
    12231222
    12241223      /* Keep OMSB up-to-date.  */
    1225       if(omsb > (unsigned) exponentChange)
     1224      if (omsb > (unsigned) exponentChange)
    12261225        omsb -= exponentChange;
    12271226      else
     
    12351234  /* As specified in IEEE 754, since we do not trap we do not report
    12361235     underflow for exact results.  */
    1237   if(lost_fraction == lfExactlyZero) {
     1236  if (lost_fraction == lfExactlyZero) {
    12381237    /* Canonicalize zeroes.  */
    1239     if(omsb == 0)
     1238    if (omsb == 0)
    12401239      category = fcZero;
    12411240
     
    12441243
    12451244  /* Increment the significand if we're rounding away from zero.  */
    1246   if(roundAwayFromZero(rounding_mode, lost_fraction, 0)) {
    1247     if(omsb == 0)
     1245  if (roundAwayFromZero(rounding_mode, lost_fraction, 0)) {
     1246    if (omsb == 0)
    12481247      exponent = semantics->minExponent;
    12491248
     
    12521251
    12531252    /* Did the significand increment overflow?  */
    1254     if(omsb == (unsigned) semantics->precision + 1) {
     1253    if (omsb == (unsigned) semantics->precision + 1) {
    12551254      /* Renormalize by incrementing the exponent and shifting our
    12561255         significand right one.  However if we already have the
    12571256         maximum exponent we overflow to infinity.  */
    1258       if(exponent == semantics->maxExponent) {
     1257      if (exponent == semantics->maxExponent) {
    12591258        category = fcInfinity;
    12601259
     
    12701269  /* The normal case - we were and are not denormal, and any
    12711270     significand increment above didn't overflow.  */
    1272   if(omsb == semantics->precision)
     1271  if (omsb == semantics->precision)
    12731272    return opInexact;
    12741273
     
    12771276
    12781277  /* Canonicalize zeroes.  */
    1279   if(omsb == 0)
     1278  if (omsb == 0)
    12801279    category = fcZero;
    12811280
     
    13251324    /* Differently signed infinities can only be validly
    13261325       subtracted.  */
    1327     if(((sign ^ rhs.sign)!=0) != subtract) {
     1326    if (((sign ^ rhs.sign)!=0) != subtract) {
    13281327      makeNaN();
    13291328      return opInvalidOp;
     
    13531352
    13541353  /* Subtraction is more subtle than one might naively expect.  */
    1355   if(subtract) {
     1354  if (subtract) {
    13561355    APFloat temp_rhs(rhs);
    13571356    bool reverse;
     
    13821381    /* Invert the lost fraction - it was on the RHS and
    13831382       subtracted.  */
    1384     if(lost_fraction == lfLessThanHalf)
     1383    if (lost_fraction == lfLessThanHalf)
    13851384      lost_fraction = lfMoreThanHalf;
    1386     else if(lost_fraction == lfMoreThanHalf)
     1385    else if (lost_fraction == lfMoreThanHalf)
    13871386      lost_fraction = lfLessThanHalf;
    13881387
     
    13911390    assert(!carry);
    13921391  } else {
    1393     if(bits > 0) {
     1392    if (bits > 0) {
    13941393      APFloat temp_rhs(rhs);
    13951394
     
    15621561
    15631562  /* This return code means it was not a simple case.  */
    1564   if(fs == opDivByZero) {
     1563  if (fs == opDivByZero) {
    15651564    lostFraction lost_fraction;
    15661565
     
    15751574     positive zero unless rounding to minus infinity, except that
    15761575     adding two like-signed zeroes gives that zero.  */
    1577   if(category == fcZero) {
    1578     if(rhs.category != fcZero || (sign == rhs.sign) == subtract)
     1576  if (category == fcZero) {
     1577    if (rhs.category != fcZero || (sign == rhs.sign) == subtract)
    15791578      sign = (rounding_mode == rmTowardNegative);
    15801579  }
     
    16071606  fs = multiplySpecials(rhs);
    16081607
    1609   if(category == fcNormal) {
     1608  if (category == fcNormal) {
    16101609    lostFraction lost_fraction = multiplySignificand(rhs, 0);
    16111610    fs = normalize(rounding_mode, lost_fraction);
    1612     if(lost_fraction != lfExactlyZero)
     1611    if (lost_fraction != lfExactlyZero)
    16131612      fs = (opStatus) (fs | opInexact);
    16141613  }
     
    16271626  fs = divideSpecials(rhs);
    16281627
    1629   if(category == fcNormal) {
     1628  if (category == fcNormal) {
    16301629    lostFraction lost_fraction = divideSignificand(rhs);
    16311630    fs = normalize(rounding_mode, lost_fraction);
    1632     if(lost_fraction != lfExactlyZero)
     1631    if (lost_fraction != lfExactlyZero)
    16331632      fs = (opStatus) (fs | opInexact);
    16341633  }
     
    16741673}
    16751674
    1676 /* Normalized llvm frem (C fmod). 
     1675/* Normalized llvm frem (C fmod).
    16771676   This is not currently correct in all cases.  */
    16781677APFloat::opStatus
     
    17311730  /* If and only if all arguments are normal do we need to do an
    17321731     extended-precision calculation.  */
    1733   if(category == fcNormal
    1734      && multiplicand.category == fcNormal
    1735      && addend.category == fcNormal) {
     1732  if (category == fcNormal &&
     1733      multiplicand.category == fcNormal &&
     1734      addend.category == fcNormal) {
    17361735    lostFraction lost_fraction;
    17371736
    17381737    lost_fraction = multiplySignificand(multiplicand, &addend);
    17391738    fs = normalize(rounding_mode, lost_fraction);
    1740     if(lost_fraction != lfExactlyZero)
     1739    if (lost_fraction != lfExactlyZero)
    17411740      fs = (opStatus) (fs | opInexact);
    17421741
     
    17441743       positive zero unless rounding to minus infinity, except that
    17451744       adding two like-signed zeroes gives that zero.  */
    1746     if(category == fcZero && sign != addend.sign)
     1745    if (category == fcZero && sign != addend.sign)
    17471746      sign = (rounding_mode == rmTowardNegative);
    17481747  } else {
     
    17561755       If we need to do the addition we can do so with normal
    17571756       precision.  */
    1758     if(fs == opOK)
     1757    if (fs == opOK)
    17591758      fs = addOrSubtract(addend, rounding_mode, false);
    17601759  }
     
    17881787  case convolve(fcInfinity, fcZero):
    17891788  case convolve(fcNormal, fcZero):
    1790     if(sign)
     1789    if (sign)
    17911790      return cmpLessThan;
    17921791    else
     
    17961795  case convolve(fcZero, fcInfinity):
    17971796  case convolve(fcZero, fcNormal):
    1798     if(rhs.sign)
     1797    if (rhs.sign)
    17991798      return cmpGreaterThan;
    18001799    else
     
    18021801
    18031802  case convolve(fcInfinity, fcInfinity):
    1804     if(sign == rhs.sign)
     1803    if (sign == rhs.sign)
    18051804      return cmpEqual;
    1806     else if(sign)
     1805    else if (sign)
    18071806      return cmpLessThan;
    18081807    else
     
    18171816
    18181817  /* Two normal numbers.  Do they have the same sign?  */
    1819   if(sign != rhs.sign) {
    1820     if(sign)
     1818  if (sign != rhs.sign) {
     1819    if (sign)
    18211820      result = cmpLessThan;
    18221821    else
     
    18261825    result = compareAbsoluteValue(rhs);
    18271826
    1828     if(sign) {
    1829       if(result == cmpLessThan)
     1827    if (sign) {
     1828      if (result == cmpLessThan)
    18301829        result = cmpGreaterThan;
    1831       else if(result == cmpGreaterThan)
     1830      else if (result == cmpGreaterThan)
    18321831        result = cmpLessThan;
    18331832    }
     
    18871886  }
    18881887
    1889   if(category == fcNormal) {
     1888  if (category == fcNormal) {
    18901889    /* Re-interpret our bit-pattern.  */
    18911890    exponent += toSemantics.precision - semantics->precision;
     
    19121911      if (APInt::tcLSB(significandParts(), newPartCount) < ushift)
    19131912        *losesInfo = true;
    1914       if (oldSemantics == &APFloat::x87DoubleExtended && 
     1913      if (oldSemantics == &APFloat::x87DoubleExtended &&
    19151914          (!(*significandParts() & 0x8000000000000000ULL) ||
    19161915           !(*significandParts() & 0x4000000000000000ULL)))
     
    19571956
    19581957  /* Handle the three special cases first.  */
    1959   if(category == fcInfinity || category == fcNaN)
     1958  if (category == fcInfinity || category == fcNaN)
    19601959    return opInvalidOp;
    19611960
    19621961  dstPartsCount = partCountForBits(width);
    19631962
    1964   if(category == fcZero) {
     1963  if (category == fcZero) {
    19651964    APInt::tcSet(parts, 0, dstPartsCount);
    19661965    // Negative zero can't be represented as an int.
     
    20052004    lost_fraction = lostFractionThroughTruncation(src, partCount(),
    20062005                                                  truncatedBits);
    2007     if (lost_fraction != lfExactlyZero
    2008         && roundAwayFromZero(rounding_mode, lost_fraction, truncatedBits)) {
     2006    if (lost_fraction != lfExactlyZero &&
     2007        roundAwayFromZero(rounding_mode, lost_fraction, truncatedBits)) {
    20092008      if (APInt::tcIncrement(parts, dstPartsCount))
    20102009        return opInvalidOp;     /* Overflow.  */
     
    20632062  opStatus fs;
    20642063
    2065   fs = convertToSignExtendedInteger(parts, width, isSigned, rounding_mode, 
     2064  fs = convertToSignExtendedInteger(parts, width, isSigned, rounding_mode,
    20662065                                    isExact);
    20672066
     
    21502149
    21512150  assertArithmeticOK(*semantics);
    2152   if (isSigned
    2153       && APInt::tcExtractBit(src, srcCount * integerPartWidth - 1)) {
     2151  if (isSigned &&
     2152      APInt::tcExtractBit(src, srcCount * integerPartWidth - 1)) {
    21542153    integerPart *copy;
    21552154
     
    21792178
    21802179  sign = false;
    2181   if(isSigned && APInt::tcExtractBit(parts, width - 1)) {
     2180  if (isSigned && APInt::tcExtractBit(parts, width - 1)) {
    21822181    sign = true;
    21832182    api = -api;
     
    21882187
    21892188APFloat::opStatus
    2190 APFloat::convertFromHexadecimalString(const StringRef &s,
    2191                                       roundingMode rounding_mode)
     2189APFloat::convertFromHexadecimalString(StringRef s, roundingMode rounding_mode)
    21922190{
    21932191  lostFraction lost_fraction = lfExactlyZero;
     
    22102208  firstSignificantDigit = p;
    22112209
    2212   for(; p != end;) {
     2210  for (; p != end;) {
    22132211    integerPart hex_value;
    22142212
    2215     if(*p == '.') {
     2213    if (*p == '.') {
    22162214      assert(dot == end && "String contains multiple dots");
    22172215      dot = p++;
     
    22222220
    22232221    hex_value = hexDigitValue(*p);
    2224     if(hex_value == -1U) {
     2222    if (hex_value == -1U) {
    22252223      break;
    22262224    }
     
    22322230    } else {
    22332231      /* Store the number whilst 4-bit nibbles remain.  */
    2234       if(bitPos) {
     2232      if (bitPos) {
    22352233        bitPos -= 4;
    22362234        hex_value <<= bitPos % integerPartWidth;
     
    22382236      } else {
    22392237        lost_fraction = trailingHexadecimalFraction(p, end, hex_value);
    2240         while(p != end && hexDigitValue(*p) != -1U)
     2238        while (p != end && hexDigitValue(*p) != -1U)
    22412239          p++;
    22422240        break;
     
    22522250
    22532251  /* Ignore the exponent if we are zero.  */
    2254   if(p != firstSignificantDigit) {
     2252  if (p != firstSignificantDigit) {
    22552253    int expAdjustment;
    22562254
     
    22622260       significant digits.  */
    22632261    expAdjustment = static_cast<int>(dot - firstSignificantDigit);
    2264     if(expAdjustment < 0)
     2262    if (expAdjustment < 0)
    22652263      expAdjustment++;
    22662264    expAdjustment = expAdjustment * 4 - 1;
     
    22882286  bool isNearest;
    22892287
    2290   isNearest = (rounding_mode == rmNearestTiesToEven
    2291                || rounding_mode == rmNearestTiesToAway);
     2288  isNearest = (rounding_mode == rmNearestTiesToEven ||
     2289               rounding_mode == rmNearestTiesToAway);
    22922290
    22932291  parts = partCountForBits(semantics->precision + 11);
     
    23642362
    23652363APFloat::opStatus
    2366 APFloat::convertFromDecimalString(const StringRef &str, roundingMode rounding_mode)
     2364APFloat::convertFromDecimalString(StringRef str, roundingMode rounding_mode)
    23672365{
    23682366  decimalInfo D;
     
    24742472
    24752473APFloat::opStatus
    2476 APFloat::convertFromString(const StringRef &str, roundingMode rounding_mode)
     2474APFloat::convertFromString(StringRef str, roundingMode rounding_mode)
    24772475{
    24782476  assertArithmeticOK(*semantics);
     
    24832481  size_t slen = str.size();
    24842482  sign = *p == '-' ? 1 : 0;
    2485   if(*p == '-' || *p == '+') {
     2483  if (*p == '-' || *p == '+') {
    24862484    p++;
    24872485    slen--;
     
    24892487  }
    24902488
    2491   if(slen >= 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
     2489  if (slen >= 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
    24922490    assert(slen - 2 && "Invalid string");
    24932491    return convertFromHexadecimalString(StringRef(p + 2, slen - 2),
     
    30143012    category = fcInfinity;
    30153013  } else if (myexponent==0x7ff && mysignificand!=0) {
    3016     // exponent meaningless.  So is the whole second word, but keep it 
     3014    // exponent meaningless.  So is the whole second word, but keep it
    30173015    // for determinism.
    30183016    category = fcNaN;
     
    30323030    else
    30333031      significandParts()[0] |= 0x10000000000000LL;  // integer bit
    3034     if (myexponent2==0) 
     3032    if (myexponent2==0)
    30353033      exponent2 = -1022;
    30363034    else
     
    32183216
    32193217  // ...and then clear the top bits for internal consistency.
    3220   significand[N-1]
    3221     &= (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1)) - 1;
     3218  significand[N-1] &=
     3219    (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1)) - 1;
    32223220
    32233221  return Val;
     
    32483246  Val.exponent = Sem.minExponent;
    32493247  Val.zeroSignificand();
    3250   Val.significandParts()[partCountForBits(Sem.precision)-1]
    3251     |= (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1));
     3248  Val.significandParts()[partCountForBits(Sem.precision)-1] |=
     3249    (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1));
    32523250
    32533251  return Val;
     
    34343432    //                 <= semantics->precision + e * 137 / 59
    34353433    //   (log_2(5) ~ 2.321928 < 2.322034 ~ 137/59)
    3436    
     3434
    34373435    unsigned precision = semantics->precision + 137 * texp / 59;
    34383436
     
    34433441    while (true) {
    34443442      if (texp & 1) significand *= five_to_the_i;
    3445      
     3443
    34463444      texp >>= 1;
    34473445      if (!texp) break;
Note: See TracChangeset for help on using the changeset viewer.