Index: src/mips/simulator-mips.cc |
diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc |
index acc65251e23f97973d991c65f4078385cec56c14..b7e53c9faa99dd1e86d2b43527a521d4b2b4a7f6 100644 |
--- a/src/mips/simulator-mips.cc |
+++ b/src/mips/simulator-mips.cc |
@@ -25,10 +25,11 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#include <stdlib.h> |
#include <limits.h> |
+#include <stdarg.h> |
+#include <stdlib.h> |
#include <cmath> |
-#include <cstdarg> |
+ |
#include "v8.h" |
#if V8_TARGET_ARCH_MIPS |
@@ -2115,7 +2116,7 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { |
// In rounding mode 0 it should behave like ROUND. |
case ROUND_W_D: // Round double to word (round half to even). |
{ |
- double rounded = floor(fs + 0.5); |
+ double rounded = std::floor(fs + 0.5); |
int32_t result = static_cast<int32_t>(rounded); |
if ((result & 1) != 0 && result - fs == 0.5) { |
// If the number is halfway between two integers, |
@@ -2140,7 +2141,7 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { |
break; |
case FLOOR_W_D: // Round double to word towards negative infinity. |
{ |
- double rounded = floor(fs); |
+ double rounded = std::floor(fs); |
int32_t result = static_cast<int32_t>(rounded); |
set_fpu_register(fd_reg, result); |
if (set_fcsr_round_error(fs, rounded)) { |
@@ -2150,7 +2151,7 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { |
break; |
case CEIL_W_D: // Round double to word towards positive infinity. |
{ |
- double rounded = ceil(fs); |
+ double rounded = std::ceil(fs); |
int32_t result = static_cast<int32_t>(rounded); |
set_fpu_register(fd_reg, result); |
if (set_fcsr_round_error(fs, rounded)) { |
@@ -2176,19 +2177,20 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { |
break; |
} |
case ROUND_L_D: { // Mips32r2 instruction. |
- double rounded = fs > 0 ? floor(fs + 0.5) : ceil(fs - 0.5); |
+ double rounded = |
+ fs > 0 ? std::floor(fs + 0.5) : std::ceil(fs - 0.5); |
i64 = static_cast<int64_t>(rounded); |
set_fpu_register(fd_reg, i64 & 0xffffffff); |
set_fpu_register(fd_reg + 1, i64 >> 32); |
break; |
} |
case FLOOR_L_D: // Mips32r2 instruction. |
- i64 = static_cast<int64_t>(floor(fs)); |
+ i64 = static_cast<int64_t>(std::floor(fs)); |
set_fpu_register(fd_reg, i64 & 0xffffffff); |
set_fpu_register(fd_reg + 1, i64 >> 32); |
break; |
case CEIL_L_D: // Mips32r2 instruction. |
- i64 = static_cast<int64_t>(ceil(fs)); |
+ i64 = static_cast<int64_t>(std::ceil(fs)); |
set_fpu_register(fd_reg, i64 & 0xffffffff); |
set_fpu_register(fd_reg + 1, i64 >> 32); |
break; |