From 0c5110ac3e3ee9b9ad1a234a3a207333ae9825bb Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Thu, 17 Jul 2014 20:52:56 -0700 Subject: [PATCH] Fixing warnings. --- src/alloy/backend/x64/x64_sequences.cc | 6 ++-- src/xenia/kernel/util/shim_utils.h | 38 +++++++++++++------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/alloy/backend/x64/x64_sequences.cc b/src/alloy/backend/x64/x64_sequences.cc index cb6f7d260..80e481a33 100644 --- a/src/alloy/backend/x64/x64_sequences.cc +++ b/src/alloy/backend/x64/x64_sequences.cc @@ -3477,7 +3477,7 @@ EMITTER(POW2_F32, MATCH(I, F32<>>)) { static __m128 EmulatePow2(__m128 src) { float src_value; _mm_store_ss(&src_value, src); - float result = std::pow(2, src_value); + float result = std::pow(2.0f, src_value); return _mm_load_ss(&result); } static void Emit(X64Emitter& e, const EmitArgType& i) { @@ -3488,7 +3488,7 @@ EMITTER(POW2_F32, MATCH(I, F32<>>)) { } }; EMITTER(POW2_F64, MATCH(I, F64<>>)) { - static __m128d EmulatePow2(__m128 src) { + static __m128d EmulatePow2(__m128d src) { double src_value; _mm_store_sd(&src_value, src); double result = std::pow(2, src_value); @@ -3506,7 +3506,7 @@ EMITTER(POW2_V128, MATCH(I, V128<>>)) { alignas(16) float values[4]; _mm_store_ps(values, src); for (size_t i = 0; i < 4; ++i) { - values[i] = std::pow(2, values[i]); + values[i] = std::pow(2.0f, values[i]); } return _mm_load_ps(values); } diff --git a/src/xenia/kernel/util/shim_utils.h b/src/xenia/kernel/util/shim_utils.h index 92245a9a8..7dfd948ff 100644 --- a/src/xenia/kernel/util/shim_utils.h +++ b/src/xenia/kernel/util/shim_utils.h @@ -29,21 +29,21 @@ using PPCContext = alloy::frontend::ppc::PPCContext; library_name, ordinals::##export_name, \ shim_data, \ (xe_kernel_export_shim_fn)export_name##_shim, \ - NULL); + nullptr); #define SHIM_MEM_BASE ppc_state->membase -#define SHIM_MEM_ADDR(a) (a ? (ppc_state->membase + a) : NULL) +#define SHIM_MEM_ADDR(a) (a ? (ppc_state->membase + a) : nullptr) -#define SHIM_MEM_8(a) (*(uint8_t*)SHIM_MEM_ADDR(a)) -#define SHIM_MEM_16(a) (uint16_t)poly::load_and_swap(SHIM_MEM_ADDR(a)) -#define SHIM_MEM_32(a) (uint32_t)poly::load_and_swap(SHIM_MEM_ADDR(a)) -#define SHIM_MEM_64(a) (uint64_t)poly::load_and_swap(SHIM_MEM_ADDR(a)) -#define SHIM_SET_MEM_8(a, v) (*(uint8_t*)SHIM_MEM_ADDR(a)) = v -#define SHIM_SET_MEM_16(a, v) (*(uint16_t*)SHIM_MEM_ADDR(a)) = poly::byte_swap(v) -#define SHIM_SET_MEM_32(a, v) (*(uint32_t*)SHIM_MEM_ADDR(a)) = poly::byte_swap(v) -#define SHIM_SET_MEM_64(a, v) (*(uint64_t*)SHIM_MEM_ADDR(a)) = poly::byte_swap(v) -#define SHIM_SET_MEM_F32(a, v) (*(float*)SHIM_MEM_ADDR(a)) = poly::byte_swap(v) -#define SHIM_SET_MEM_F64(a, v) (*(double*)SHIM_MEM_ADDR(a)) = poly::byte_swap(v) +#define SHIM_MEM_8(a) poly::load_and_swap(SHIM_MEM_ADDR(a)) +#define SHIM_MEM_16(a) poly::load_and_swap(SHIM_MEM_ADDR(a)) +#define SHIM_MEM_32(a) poly::load_and_swap(SHIM_MEM_ADDR(a)) +#define SHIM_MEM_64(a) poly::load_and_swap(SHIM_MEM_ADDR(a)) +#define SHIM_SET_MEM_8(a, v) poly::store_and_swap(SHIM_MEM_ADDR(a), v) +#define SHIM_SET_MEM_16(a, v) poly::store_and_swap(SHIM_MEM_ADDR(a), v) +#define SHIM_SET_MEM_32(a, v) poly::store_and_swap(SHIM_MEM_ADDR(a), v) +#define SHIM_SET_MEM_64(a, v) poly::store_and_swap(SHIM_MEM_ADDR(a), v) +#define SHIM_SET_MEM_F32(a, v) poly::store_and_swap(SHIM_MEM_ADDR(a), v) +#define SHIM_SET_MEM_F64(a, v) poly::store_and_swap(SHIM_MEM_ADDR(a), v) #define SHIM_GPR_8(n) (uint8_t)(ppc_state->r[n]) #define SHIM_GPR_16(n) (uint16_t)(ppc_state->r[n]) @@ -60,14 +60,14 @@ using PPCContext = alloy::frontend::ppc::PPCContext; #define SHIM_SET_RETURN_64(v) SHIM_SET_GPR_64(3, v) -#define IMPL_MEM_ADDR(a) (a ? state->memory()->Translate(a) : NULL) +#define IMPL_MEM_ADDR(a) (a ? state->memory()->Translate(a) : nullptr) -#define IMPL_MEM_8(a) (*(uint8_t*)(IMPL_MEM_ADDR(a))) -#define IMPL_MEM_16(a) (uint16_t)poly::load_and_swap(IMPL_MEM_ADDR(a)) -#define IMPL_MEM_32(a) (uint32_t)poly::load_and_swap(IMPL_MEM_ADDR(a)) -#define IMPL_SET_MEM_8(a, v) (*(uint8_t*)IMPL_MEM_ADDR(a)) = v -#define IMPL_SET_MEM_16(a, v) (*(uint16_t*)IMPL_MEM_ADDR(a)) = poly::byte_swap(v) -#define IMPL_SET_MEM_32(a, v) (*(uint32_t*)IMPL_MEM_ADDR(a)) = poly::byte_swap(v) +#define IMPL_MEM_8(a) poly::load_and_swap(IMPL_MEM_ADDR(a)) +#define IMPL_MEM_16(a) poly::load_and_swap(IMPL_MEM_ADDR(a)) +#define IMPL_MEM_32(a) poly::load_and_swap(IMPL_MEM_ADDR(a)) +#define IMPL_SET_MEM_8(a, v) poly::store_and_swap(IMPL_MEM_ADDR(a), v) +#define IMPL_SET_MEM_16(a, v) poly::store_and_swap(IMPL_MEM_ADDR(a), v) +#define IMPL_SET_MEM_32(a, v) poly::store_and_swap(IMPL_MEM_ADDR(a), v) } // namespace kernel