Changeset 205577 in webkit


Ignore:
Timestamp:
Sep 7, 2016 5:40:17 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

bitwise_cast: allow const destination type
https://bugs.webkit.org/show_bug.cgi?id=161719

Patch by JF Bastien <jfbastien@apple.com> on 2016-09-07
Reviewed by Saam Barati.

  • wtf/StdLibExtras.h:

(WTF::bitwise_cast): allow const To to = bitwise_cast<const To>(from);

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r205569 r205577  
     12016-09-07  JF Bastien  <jfbastien@apple.com>
     2
     3        bitwise_cast: allow const destination type
     4        https://bugs.webkit.org/show_bug.cgi?id=161719
     5
     6        Reviewed by Saam Barati.
     7
     8        * wtf/StdLibExtras.h:
     9        (WTF::bitwise_cast): allow `const To to = bitwise_cast<const To>(from);`
     10
    1112016-09-07  Mark Lam  <mark.lam@apple.com>
    212
  • trunk/Source/WTF/wtf/StdLibExtras.h

    r205362 r205577  
    152152    static_assert(__is_trivially_copyable(FromType), "bitwise_cast of non-trivially-copyable type!");
    153153#endif
    154     ToType to{ };
     154    typename std::remove_const<ToType>::type to { };
    155155    std::memcpy(&to, &from, sizeof(to));
    156156    return to;
Note: See TracChangeset for help on using the changeset viewer.