Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: src/objects.cc

Issue 160269: Change custom NaN check to use isnan to fix pixel array... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
===================================================================
--- src/objects.cc (revision 2555)
+++ src/objects.cc (working copy)
@@ -7060,20 +7060,16 @@
if (value->IsSmi()) {
int_value = Smi::cast(value)->value();
} else if (value->IsHeapNumber()) {
- static const DoubleRepresentation nan(OS::nan_value());
- DoubleRepresentation double_value = HeapNumber::cast(value)->value();
- if (nan.bits != double_value.bits) {
- int_value = static_cast<int>(double_value.value + 0.5);
- } else {
- // NaN clamps to zero.
- int_value = 0;
+ double double_value = HeapNumber::cast(value)->value();
+ if (!isnan(double_value)) {
+ // NaN clamps to zero (default). Other doubles are rounded to
+ // the nearest integer.
+ int_value = static_cast<int>(double_value + 0.5);
}
- } else if (value->IsUndefined()) {
- int_value = 0;
} else {
- // All other types have been converted to a number type further up in the
- // call chain.
- UNREACHABLE();
+ // Clamp undefined to zero (default). All other types have been
+ // converted to a number type further up in the call chain.
+ ASSERT(value->IsUndefined());
}
if (int_value < 0) {
clamped_value = 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698