Ignore:
Timestamp:
Dec 30, 2007, 11:02:26 PM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Sam.

Remove maxInt/minInt, replacing with std:max/min<int>()

  • kjs/array_object.cpp: (KJS::ArrayProtoFuncSplice::callAsFunction):
  • kjs/operations.cpp:
  • kjs/operations.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/array_object.cpp

    r28468 r29045  
    3232#include <wtf/Assertions.h>
    3333#include <wtf/HashSet.h>
     34
     35#include <algorithm> // for std::min
    3436
    3537namespace KJS {
     
    449451JSValue* ArrayProtoFuncSplice::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
    450452{
    451     // 15.4.4.12 - oh boy this is huge
     453    // 15.4.4.12
    452454    JSObject *resObj = static_cast<JSObject *>(exec->lexicalGlobalObject()->arrayConstructor()->construct(exec, List::empty()));
    453455    JSValue* result = resObj;
    454456    unsigned length = thisObj->get(exec, exec->propertyNames().length)->toUInt32(exec);
    455457    int begin = args[0]->toUInt32(exec);
    456     if ( begin < 0 )
    457       begin = maxInt( begin + length, 0 );
     458    if (begin < 0)
     459        begin = std::max<int>(begin + length, 0);
    458460    else
    459       begin = minInt( begin, length );
    460     unsigned int deleteCount = minInt( maxInt( args[1]->toUInt32(exec), 0 ), length - begin );
    461 
    462     //printf( "Splicing from %d, deleteCount=%d \n", begin, deleteCount );
     461        begin = std::min<int>(begin, length);
     462    unsigned int deleteCount = std::min<int>(std::max<int>(args[1]->toUInt32(exec), 0), length - begin);
     463
    463464    for(unsigned int k = 0; k < deleteCount; k++) {
    464465      if (JSValue *v = getProperty(exec, thisObj, k+begin))
     
    467468    resObj->put(exec, exec->propertyNames().length, jsNumber(deleteCount), DontEnum | DontDelete);
    468469
    469     unsigned int additionalArgs = maxInt( args.size() - 2, 0 );
     470    unsigned int additionalArgs = std::max<int>(args.size() - 2, 0);
    470471    if ( additionalArgs != deleteCount )
    471472    {
Note: See TracChangeset for help on using the changeset viewer.