Changeset 231035 in webkit


Ignore:
Timestamp:
Apr 25, 2018 5:13:35 PM (6 years ago)
Author:
mark.lam@apple.com
Message:

Gardening: Speculative build fix for Windows 32-bit to compensate for MSVC's lack of smarts.
https://bugs.webkit.org/show_bug.cgi?id=184976
<rdar://problem/39723901>

Not reviewed.

According to https://stackoverflow.com/questions/37658794/integer-constant-overflow-warning-in-constexpr,
disabling the warning around the definition of the function will not disable it
for all clients of the function.

  • wtf/PtrTag.h:

(WTF::makePtrTagHash):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r231027 r231035  
     12018-04-25  Mark Lam  <mark.lam@apple.com>
     2
     3        Gardening: Speculative build fix for Windows 32-bit to compensate for MSVC's lack of smarts.
     4        https://bugs.webkit.org/show_bug.cgi?id=184976
     5        <rdar://problem/39723901>
     6
     7        Not reviewed.
     8
     9        According to https://stackoverflow.com/questions/37658794/integer-constant-overflow-warning-in-constexpr,
     10        disabling the warning around the definition of the function will not disable it
     11        for all clients of the function.
     12
     13        * wtf/PtrTag.h:
     14        (WTF::makePtrTagHash):
     15
    1162018-04-25  Mark Lam  <mark.lam@apple.com>
    217
  • trunk/Source/WTF/wtf/PtrTag.h

    r231027 r231035  
    4949constexpr uintptr_t makePtrTagHash(const char (&str)[N])
    5050{
     51    // The only reason for the following dance with casting to result64Bit and
     52    // back is because, on 32-bit, MSVC will complain about "C4307: integral
     53    // constant overflow" but not allow us to disable the warning for all clients
     54    // of this function.
    5155    uintptr_t result = 134775813;
    52     for (size_t i = 0; i < N; ++i)
    53         result += ((result * str[i]) ^ (result >> 16));
     56    for (size_t i = 0; i < N; ++i) {
     57        uint64_t result64Bit = static_cast<uint64_t>(result);
     58        result64Bit += ((result64Bit * str[i]) ^ (result64Bit >> 16));
     59        result = static_cast<uintptr_t>(result64Bit);
     60    }
    5461    return result & 0xffff;
    5562}
Note: See TracChangeset for help on using the changeset viewer.