⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243544 in webkit


Ignore:
Timestamp:
Mar 27, 2019, 9:12:22 AM (7 years ago)
Author:
pvollan@apple.com
Message:

Layout Test js/math-clz32.html is failing
https://bugs.webkit.org/show_bug.cgi?id=196209

Reviewed by Ross Kirsling.

Source/WTF:

Use the correct number of loop iterations when counting leading zeros. Also, the
count was off by one for the Win64 case.

  • wtf/MathExtras.h:

(WTF::clz):

LayoutTests:

  • platform/win/TestExpectations:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243539 r243544  
     12019-03-27  Per Arne Vollan  <pvollan@apple.com>
     2
     3        Layout Test js/math-clz32.html is failing
     4        https://bugs.webkit.org/show_bug.cgi?id=196209
     5
     6        Reviewed by Ross Kirsling.
     7
     8        * platform/win/TestExpectations:
     9
    1102019-03-26  Simon Fraser  <simon.fraser@apple.com>
    211
  • trunk/LayoutTests/platform/win/TestExpectations

    r243515 r243544  
    43044304webkit.org/b/195461 http/tests/referrer-policy-iframe/unsafe-url/cross-origin-http.https.html [ Failure ]
    43054305
    4306 webkit.org/b/196209 js/math-clz32.html [ Failure ]
  • trunk/Source/WTF/ChangeLog

    r243524 r243544  
     12019-03-27  Per Arne Vollan  <pvollan@apple.com>
     2
     3        Layout Test js/math-clz32.html is failing
     4        https://bugs.webkit.org/show_bug.cgi?id=196209
     5
     6        Reviewed by Ross Kirsling.
     7
     8        Use the correct number of loop iterations when counting leading zeros. Also, the
     9        count was off by one for the Win64 case.
     10
     11        * wtf/MathExtras.h:
     12        (WTF::clz):
     13
    1142019-03-26  Keith Rollin  <krollin@apple.com>
    215
  • trunk/Source/WTF/wtf/MathExtras.h

    r243429 r243544  
    620620{
    621621    constexpr unsigned bitSize = sizeof(T) * CHAR_BIT;
    622     constexpr unsigned bitSize64 = sizeof(uint64_t) * CHAR_BIT;
    623622
    624623    using UT = typename std::make_unsigned<T>::type;
     
    626625
    627626#if COMPILER(GCC_COMPATIBLE)
     627    constexpr unsigned bitSize64 = sizeof(uint64_t) * CHAR_BIT;
    628628    if (uValue)
    629629        return __builtin_clzll(uValue) - (bitSize64 - bitSize);
     
    635635    unsigned long ret = 0;
    636636    if (_BitScanReverse64(&ret, uValue))
    637         return bitSize - ret;
     637        return bitSize - 1 - ret;
    638638    return bitSize;
    639639#else
    640640    unsigned zeroCount = 0;
    641     for (int i = bitSize64 - 1; i >= 0; i--) {
    642         if (!(static_cast<uint64_t>(uValue) >> i))
    643             zeroCount++;
    644         else
     641    for (int i = bitSize - 1; i >= 0; i--) {
     642        if (uValue >> i)
    645643            break;
     644        zeroCount++;
    646645    }
    647646    return zeroCount;
Note: See TracChangeset for help on using the changeset viewer.