mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 22:59:47 -06:00
MemoryView: Get rid of a type-punning cast from u32 to float
This is undefined behavior. The bits should be memcpyed.
This commit is contained in:
@ -2,9 +2,12 @@
|
|||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "DolphinWX/Debugger/MemoryView.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <wx/brush.h>
|
#include <wx/brush.h>
|
||||||
#include <wx/clipbrd.h>
|
#include <wx/clipbrd.h>
|
||||||
@ -24,7 +27,6 @@
|
|||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "DolphinWX/Debugger/CodeWindow.h"
|
#include "DolphinWX/Debugger/CodeWindow.h"
|
||||||
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
||||||
#include "DolphinWX/Debugger/MemoryView.h"
|
|
||||||
#include "DolphinWX/Debugger/WatchWindow.h"
|
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||||
#include "DolphinWX/Frame.h"
|
#include "DolphinWX/Frame.h"
|
||||||
#include "DolphinWX/Globals.h"
|
#include "DolphinWX/Globals.h"
|
||||||
@ -112,8 +114,9 @@ wxString CMemoryView::ReadMemoryAsString(u32 address) const
|
|||||||
|
|
||||||
if (m_data_type == MemoryDataType::FloatingPoint)
|
if (m_data_type == MemoryDataType::FloatingPoint)
|
||||||
{
|
{
|
||||||
float& flt = reinterpret_cast<float&>(mem_data);
|
float real;
|
||||||
str = StringFromFormat("f: %f", flt);
|
std::memcpy(&real, &mem_data, sizeof(u32));
|
||||||
|
str = StringFromFormat("f: %f", real);
|
||||||
}
|
}
|
||||||
else if (m_data_type == MemoryDataType::ASCII)
|
else if (m_data_type == MemoryDataType::ASCII)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user