Ignore:
Timestamp:
Nov 13, 2007, 12:37:17 PM (18 years ago)
Author:
[email protected]
Message:

2007-11-13 Eric Seidel <[email protected]>

Reviewed by Maciej.

Add an ASSERT to getTruncatedInt32 to enforce proper usage.
Best part about this patch? It doesn't break the web!

  • kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32): (KJS::JSImmediate::toDouble): (KJS::JSImmediate::getUInt32):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSImmediate.h

    r27751 r27759  
    243243ALWAYS_INLINE int32_t JSImmediate::getTruncatedInt32(const JSValue* v)
    244244{
     245    ASSERT(isNumber(v));
    245246    return static_cast<int32_t>(unTag(v)) >> 2;
    246247}
     
    249250{
    250251    ASSERT(isImmediate(v));
    251     const int32_t i = getTruncatedInt32(v);
     252    const int32_t i = static_cast<int32_t>(unTag(v)) >> 2;
    252253    if (JSImmediate::getTag(v) == UndefinedType && i)
    253254        return std::numeric_limits<double>::quiet_NaN();
     
    257258ALWAYS_INLINE bool JSImmediate::getUInt32(const JSValue* v, uint32_t& i)
    258259{
    259     const int32_t si = getTruncatedInt32(v);
     260    const int32_t si = static_cast<int32_t>(unTag(v)) >> 2;
    260261    i = si;
    261262    return isNumber(v) & (si >= 0);
     
    264265ALWAYS_INLINE bool JSImmediate::getTruncatedInt32(const JSValue* v, int32_t& i)
    265266{
    266     i = getTruncatedInt32(v);
     267    i = static_cast<int32_t>(unTag(v)) >> 2;
    267268    return isNumber(v);
    268269}
Note: See TracChangeset for help on using the changeset viewer.