Changeset 10510 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Sep 10, 2005, 11:24:44 AM (20 years ago)
Author:
darin
Message:

Windows changes by Krzysztof Kowalczyk <[email protected]>.

  • kjs/simple_number.h: (KJS::isNegativeZero): Added. Inline function. Has a case for Windows that uses _fpclass and a case for other platforms that uses signbit. (KJS::SimpleNumber::fits): Use inline isNegativeZero instead of macro IS_NEGATIVE_ZERO.
  • kjs/internal.cpp: Remove definition of now-unneeded negZero global.
  • kjs/value.cpp: Touched the file because Xcode didn't know it needed to recompile it.
  • improved test engine
  • tests/mozilla/jsDriver.pl: Sort tests in numeric order instead of using a plain-ASCII sort; now test 33 will be after test 5 in any given set of numbered tests.
Location:
trunk/JavaScriptCore/kjs
Files:
3 edited

Legend:

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

    r10456 r10510  
    264264  return (double)uint32 == val;
    265265}
    266 
    267 double SimpleNumber::negZero = -0.0;
    268266
    269267// ------------------------------ LabelStack -----------------------------------
  • trunk/JavaScriptCore/kjs/simple_number.h

    r9768 r10510  
    1 // -*- c-basic-offset: 2 -*-
    21/*
    32 *  This file is part of the KDE libraries
     
    2120 */
    2221
    23 #ifndef _KJS_SIMPLE_NUMBER_H_
    24 #define _KJS_SIMPLE_NUMBER_H_
     22#ifndef KJS_SIMPLE_NUMBER_H
     23#define KJS_SIMPLE_NUMBER_H
    2524
     25#include <float.h>
    2626#include <math.h>
    2727#include <string.h>
    2828
    29 #define IS_NEGATIVE_ZERO(num) (num == 0.0 && !memcmp(&num, &SimpleNumber::negZero, sizeof(double)))
     29namespace KJS {
    3030
    31 namespace KJS {
    3231    class ValueImp;
    3332
     33    inline bool isNegativeZero(double num)
     34    {
     35#if WIN32
     36        return _fpclass(num) == _FPCLASS_NZ;
     37#else
     38        return num == -0.0 && signbit(num);
     39#endif
     40    }
     41   
    3442    class SimpleNumber {
    3543    public:
     
    4452        static inline bool fits(unsigned long i) { return i <= (unsigned)max; }
    4553        static inline bool integerFits(double d) { return !(d < min || d > max); }
    46         static inline bool fits(double d) { return d >= min && d <= max && d == (double)(long)d && !IS_NEGATIVE_ZERO(d); }
     54        static inline bool fits(double d) { return d >= min && d <= max && d == (double)(long)d && !isNegativeZero(d); }
    4755        static inline ValueImp *make(long i) { return (ValueImp *)((i << shift) | tag); }
     56    };
    4857
    49         static double negZero;
    50     };
    5158}
    5259
  • trunk/JavaScriptCore/kjs/value.cpp

    r10084 r10510  
    4646AllocatedValueImp *ConstantValues::NaN = NULL;
    4747
    48 static const double D16 = 65536;
     48static const double D16 = 65536.0;
    4949static const double D32 = 4294967296.0;
    5050
Note: See TracChangeset for help on using the changeset viewer.