Changeset 26892 in webkit for trunk/JavaScriptCore/kjs/value.cpp
- Timestamp:
- Oct 22, 2007, 11:39:46 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/value.cpp
r24633 r26892 1 1 /* 2 * This file is part of the KDE libraries3 2 * Copyright (C) 1999-2001 Harri Porten ([email protected]) 4 3 * Copyright (C) 2001 Peter Kelly ([email protected]) 5 * Copyright (C) 2003 Apple Computer, Inc.4 * Copyright (C) 2003, 2007 Apple Inc. All rights reserved. 6 5 * 7 6 * This library is free software; you can redistribute it and/or … … 42 41 } 43 42 44 bool JSCell::getUInt32(unsigned&) const 43 bool JSCell::getInt32(int32_t&) const 44 { 45 return false; 46 } 47 48 bool JSCell::getUInt32(uint32_t&) const 45 49 { 46 50 return false; … … 56 60 } 57 61 58 int32_t JSValue::toInt32(ExecState* exec) const 59 { 60 bool ok; 61 return toInt32(exec, ok); 62 } 63 64 int32_t JSValue::toInt32(ExecState* exec, bool& ok) const 62 int32_t JSValue::toInt32SlowCase(ExecState* exec, bool& ok) const 65 63 { 66 64 ok = true; 67 65 68 uint32_t i;69 if (get UInt32(i))66 int32_t i; 67 if (getInt32(i)) 70 68 return i; 71 69 72 70 double d = roundValue(exec, const_cast<JSValue*>(this)); 71 if (d >= -D32 / 2 && d < D32 / 2) 72 return static_cast<int32_t>(d); 73 73 74 if (isNaN(d) || isInf(d)) { 74 75 ok = false; … … 85 86 } 86 87 87 uint32_t JSValue::toUInt32(ExecState* exec) const 88 { 89 bool ok; 90 return toUInt32(exec, ok); 91 } 92 93 uint32_t JSValue::toUInt32(ExecState* exec, bool& ok) const 88 uint32_t JSValue::toUInt32SlowCase(ExecState* exec, bool& ok) const 94 89 { 95 90 ok = true; … … 100 95 101 96 double d = roundValue(exec, const_cast<JSValue*>(this)); 97 if (d >= 0.0 && d < D32) 98 return static_cast<uint32_t>(d); 99 102 100 if (isNaN(d) || isInf(d)) { 103 101 ok = false; … … 119 117 120 118 double d = roundValue(exec, const_cast<JSValue*>(this)); 119 if (d >= 0.0 && d < D16) 120 return static_cast<uint16_t>(d); 121 121 122 if (isNaN(d) || isInf(d)) 122 123 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.