From e1b36b3b6b5b12907b873758578f2e7eb5edf5d6 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Thu, 25 Jul 2013 08:49:52 +0000 Subject: [PATCH] Don't duplicate ceiling() for every POSIX platform. R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/20274002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15872 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/platform-cygwin.cc | 5 ----- src/platform-freebsd.cc | 10 ---------- src/platform-linux.cc | 5 ----- src/platform-macos.cc | 10 ---------- src/platform-openbsd.cc | 5 ----- src/platform-posix.cc | 6 ++++++ src/platform-solaris.cc | 5 ----- 7 files changed, 6 insertions(+), 40 deletions(-) diff --git a/src/platform-cygwin.cc b/src/platform-cygwin.cc index c34330b..6be908e 100644 --- a/src/platform-cygwin.cc +++ b/src/platform-cygwin.cc @@ -52,11 +52,6 @@ namespace v8 { namespace internal { -double ceiling(double x) { - return ceil(x); -} - - static Mutex* limit_mutex = NULL; diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc index d7544db..e403d6d 100644 --- a/src/platform-freebsd.cc +++ b/src/platform-freebsd.cc @@ -63,16 +63,6 @@ namespace v8 { namespace internal { -double ceiling(double x) { - // Correct as on OS X - if (-1.0 < x && x < 0.0) { - return -0.0; - } else { - return ceil(x); - } -} - - static Mutex* limit_mutex = NULL; diff --git a/src/platform-linux.cc b/src/platform-linux.cc index 245dae4..febd668 100644 --- a/src/platform-linux.cc +++ b/src/platform-linux.cc @@ -76,11 +76,6 @@ namespace v8 { namespace internal { -double ceiling(double x) { - return ceil(x); -} - - static Mutex* limit_mutex = NULL; diff --git a/src/platform-macos.cc b/src/platform-macos.cc index 12a3e66..8ec4c51 100644 --- a/src/platform-macos.cc +++ b/src/platform-macos.cc @@ -79,16 +79,6 @@ namespace v8 { namespace internal { -double ceiling(double x) { - // Correct Mac OS X Leopard 'ceil' behavior. - if (-1.0 < x && x < 0.0) { - return -0.0; - } else { - return ceil(x); - } -} - - static Mutex* limit_mutex = NULL; diff --git a/src/platform-openbsd.cc b/src/platform-openbsd.cc index df08a7a..a94bfe8 100644 --- a/src/platform-openbsd.cc +++ b/src/platform-openbsd.cc @@ -61,11 +61,6 @@ namespace v8 { namespace internal { -double ceiling(double x) { - return ceil(x); -} - - static Mutex* limit_mutex = NULL; diff --git a/src/platform-posix.cc b/src/platform-posix.cc index 804b38b..9bc3193 100644 --- a/src/platform-posix.cc +++ b/src/platform-posix.cc @@ -225,6 +225,12 @@ void OS::DebugBreak() { // ---------------------------------------------------------------------------- // Math functions +double ceiling(double x) { + // Correct buggy 'ceil' on some systems (i.e. FreeBSD, OS X 10.5) + return (-1.0 < x && x < 0.0) ? -0.0 : ceil(x); +} + + double modulo(double x, double y) { return fmod(x, y); } diff --git a/src/platform-solaris.cc b/src/platform-solaris.cc index 1ecca16..cb9ba18 100644 --- a/src/platform-solaris.cc +++ b/src/platform-solaris.cc @@ -81,11 +81,6 @@ namespace v8 { namespace internal { -double ceiling(double x) { - return ceil(x); -} - - static Mutex* limit_mutex = NULL; -- 2.7.4