Changeset 65962 in webkit for trunk/JavaScriptCore/wtf/dtoa.cpp


Ignore:
Timestamp:
Aug 24, 2010, 6:21:16 PM (15 years ago)
Author:
[email protected]
Message:

Windows build fix.

  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
  • wtf/DecimalNumber.h:

(WTF::DecimalNumber::intPow10):

  • wtf/dtoa.cpp:
  • wtf/dtoa.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/dtoa.cpp

    r65959 r65962  
    22862286}
    22872287
    2288 double intPow10(int e)
    2289 {
    2290     // This function uses the "exponentiation by squaring" algorithm and
    2291     // long double to quickly and precisely calculate integer powers of 10.0.
    2292 
    2293     // This is a handy workaround for <rdar://problem/4494756>
    2294 
    2295     if (!e)
    2296         return 1.0;
    2297 
    2298     bool negative = e < 0;
    2299     unsigned exp = negative ? -e : e;
    2300 
    2301     long double result = 10.0;
    2302     bool foundOne = false;
    2303     for (int bit = 31; bit >= 0; bit--) {
    2304         if (!foundOne) {
    2305             if ((exp >> bit) & 1)
    2306                 foundOne = true;
    2307         } else {
    2308             result = result * result;
    2309             if ((exp >> bit) & 1)
    2310                 result = result * 10.0;
    2311         }
    2312     }
    2313 
    2314     if (negative)
    2315         return static_cast<double>(1.0 / result);
    2316     return static_cast<double>(result);
    2317 }
    2318 
    23192288} // namespace WTF
Note: See TracChangeset for help on using the changeset viewer.