Changeset 184369 in webkit


Ignore:
Timestamp:
May 14, 2015, 9:36:27 PM (10 years ago)
Author:
mitz@apple.com
Message:

Reverted r177753, now that <rdar://problem/19347133> is fixed.

Rubber-stamped by Benjamin Poulain.

  • wtf/SaturatedArithmetic.h:

(signedAddOverflows):
(signedSubtractOverflows):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r184341 r184369  
     12015-05-14  Dan Bernstein  <mitz@apple.com>
     2
     3        Reverted r177753, now that <rdar://problem/19347133> is fixed.
     4
     5        Rubber-stamped by Benjamin Poulain.
     6
     7        * wtf/SaturatedArithmetic.h:
     8        (signedAddOverflows):
     9        (signedSubtractOverflows):
     10
    1112015-05-14  Myles C. Maxfield  <mmaxfield@apple.com>
    212
  • trunk/Source/WTF/wtf/SaturatedArithmetic.h

    r182676 r184369  
    4040inline bool signedAddOverflows(int32_t a, int32_t b, int32_t& result)
    4141{
     42#if COMPILER_HAS_CLANG_BUILTIN(__builtin_sadd_overflow)
     43    return __builtin_sadd_overflow(a, b, &result);
     44#else
    4245    uint32_t ua = a;
    4346    uint32_t ub = b;
     
    4851    // bit of the result and one of the values differ it did overflow.
    4952    return !((ua ^ ub) >> 31) && (uresult ^ ua) >> 31;
     53#endif
    5054}
    5155
     
    6872inline bool signedSubtractOverflows(int32_t a, int32_t b, int32_t& result)
    6973{
     74#if COMPILER_HAS_CLANG_BUILTIN(__builtin_ssub_overflow)
     75    return __builtin_ssub_overflow(a, b, &result);
     76#else
    7077    uint32_t ua = a;
    7178    uint32_t ub = b;
     
    7683    // signed bit of the result and the first value differ it did overflow.
    7784    return (ua ^ ub) >> 31 && (uresult ^ ua) >> 31;
     85#endif
    7886}
    7987
Note: See TracChangeset for help on using the changeset viewer.