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

Unified Diff: runtime/lib/double.cc

Issue 1160453003: Fix 23563: double unary- operator unstable for NANs (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanuo Created 5 years, 7 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 | runtime/lib/double.dart » ('j') | runtime/lib/double.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/double.cc
diff --git a/runtime/lib/double.cc b/runtime/lib/double.cc
index 4173c1403d034ad917f12dea13d7f23cd2fc1f4b..8250d25f594d0f15da096fe544b22eb59d3e2951 100644
--- a/runtime/lib/double.cc
+++ b/runtime/lib/double.cc
@@ -300,6 +300,16 @@ DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) {
return Bool::Get(signbit(dval) && !isnan(dval)).raw();
}
+
+DEFINE_NATIVE_ENTRY(Double_flipSignBit, 1) {
+ const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0));
+ const double in_val = arg.value();
+ const int64_t bits =
+ *(reinterpret_cast<const int64_t*>(&in_val)) ^ 0x8000000000000000LL;
koda 2015/06/02 23:41:02 Consider putting the constant in globals.h. Also,
koda 2015/06/02 23:41:02 Just curious: I wonder if there is any spec/de-fac
srdjan 2015/06/03 00:02:51 AFAIK yes, we are using it in simd28.cc and assemb
srdjan 2015/06/03 00:02:51 As far as I remember, I had problems with doing it
+ const double out_val = *(reinterpret_cast<const double*>(&bits));
+ return Double::New(out_val);
+}
+
// Add here only functions using/referring to old-style casts.
} // namespace dart
« no previous file with comments | « no previous file | runtime/lib/double.dart » ('j') | runtime/lib/double.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698