From ce3fdeda5e42d2b7bc9b03f4118a3bff02052220 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 19 May 2016 09:15:56 -0700 Subject: [PATCH] Replace math macros by function calls from cmath. (#1695) --- rpcs3/Emu/Cell/Modules/libmixer.cpp | 3 ++- rpcs3/Emu/Cell/PPUInterpreter.cpp | 3 ++- rpcs3/Emu/Cell/SPUThread.h | 3 ++- rpcs3/Emu/RSX/rsx_utils.h | 6 ++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/libmixer.cpp b/rpcs3/Emu/Cell/Modules/libmixer.cpp index e40ce2ffa7..2813a039bb 100644 --- a/rpcs3/Emu/Cell/Modules/libmixer.cpp +++ b/rpcs3/Emu/Cell/Modules/libmixer.cpp @@ -5,6 +5,7 @@ #include "cellAudio.h" #include "libmixer.h" +#include LOG_CHANNEL(libmixer); @@ -355,7 +356,7 @@ s32 cellSurMixerCreate(vm::cptr config) auto v = vm::ptrl::make(p.m_addr); // 16-bit LE audio data float left = 0.0f; float right = 0.0f; - float speed = fabs(p.m_speed); + float speed = std::fabs(p.m_speed); float fpos = 0.0f; for (s32 i = 0; i < 256; i++) if (p.m_active) { diff --git a/rpcs3/Emu/Cell/PPUInterpreter.cpp b/rpcs3/Emu/Cell/PPUInterpreter.cpp index b08b558d1b..5601971adf 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/PPUInterpreter.cpp @@ -2,6 +2,7 @@ #include "Emu/System.h" #include "PPUThread.h" #include "PPUInterpreter.h" +#include // TODO: fix rol8 and rol16 for __GNUG__ (probably with __asm__) inline u8 rol8(const u8 x, const u8 n) { return x << n | x >> (8 - n); } @@ -135,7 +136,7 @@ public: { for (s32 i = -31; i < 32; i++) { - m_data[i + 31] = _mm_set1_ps(static_cast(exp2(i))); + m_data[i + 31] = _mm_set1_ps(static_cast(std::exp2(i))); } } diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index 187c3a6aa6..38bb09e2b0 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -4,6 +4,7 @@ #include "Emu/CPU/CPUThread.h" #include "Emu/Cell/SPUInterpreter.h" #include "MFC.h" +#include class lv2_event_queue_t; struct lv2_spu_group_t; @@ -383,7 +384,7 @@ struct spu_imm_table_t { for (s32 i = -155; i < 174; i++) { - m_data[i + 155] = _mm_set1_ps(static_cast(exp2(i))); + m_data[i + 155] = _mm_set1_ps(static_cast(std::exp2(i))); } } diff --git a/rpcs3/Emu/RSX/rsx_utils.h b/rpcs3/Emu/RSX/rsx_utils.h index b45301d679..989c4470a5 100644 --- a/rpcs3/Emu/RSX/rsx_utils.h +++ b/rpcs3/Emu/RSX/rsx_utils.h @@ -5,6 +5,8 @@ extern "C" #include } +#include + namespace rsx { template @@ -32,8 +34,8 @@ namespace rsx template void convert_linear_swizzle(void* input_pixels, void* output_pixels, u16 width, u16 height, bool input_is_swizzled) { - u16 log2width = ::narrow(ceil(log2(width))); - u16 log2height = ::narrow(ceil(log2(height))); + u16 log2width = ::narrow(ceil(std::log2(width))); + u16 log2height = ::narrow(ceil(std::log2(height))); // Max mask possible for square texture u32 x_mask = 0x55555555;