From dc66b3d47460256e66c217881b21d397766bcd42 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 17 Jul 2013 04:22:47 -0500 Subject: [PATCH] Add Read_F32 and Read_F64 helper functions to MemmapFunctions. --- Source/Core/Core/Src/HW/Memmap.h | 5 +++++ Source/Core/Core/Src/HW/MemmapFunctions.cpp | 24 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Source/Core/Core/Src/HW/Memmap.h b/Source/Core/Core/Src/HW/Memmap.h index 85deac8fce..a4cef35cf6 100644 --- a/Source/Core/Core/Src/HW/Memmap.h +++ b/Source/Core/Core/Src/HW/Memmap.h @@ -136,6 +136,11 @@ u16 Read_U16(const u32 _Address); u32 Read_U32(const u32 _Address); u64 Read_U64(const u32 _Address); +// Useful helper functions, used by ARM JIT +float Read_F32(const u32 _Address); +double Read_F64(const u32 _Address); + + // used by JIT. Return zero-extended 32bit values u32 Read_U8_ZX(const u32 _Address); u32 Read_U16_ZX(const u32 _Address); diff --git a/Source/Core/Core/Src/HW/MemmapFunctions.cpp b/Source/Core/Core/Src/HW/MemmapFunctions.cpp index e7422490c9..b60fd8d50d 100644 --- a/Source/Core/Core/Src/HW/MemmapFunctions.cpp +++ b/Source/Core/Core/Src/HW/MemmapFunctions.cpp @@ -403,6 +403,30 @@ u64 Read_U64(const u32 _Address) return _var; } +double Read_F64(const u32 _Address) +{ + union + { + u64 i; + double d; + } cvt; + + cvt.i = Read_U64(_Address); + return cvt.d; +} + +float Read_F32(const u32 _Address) +{ + union + { + u32 i; + float d; + } cvt; + + cvt.i = Read_U32(_Address); + return cvt.d; +} + u32 Read_U8_ZX(const u32 _Address) { return (u32)Read_U8(_Address);