Don't cast pointers to integers on non-32-bit architectures

This commit is contained in:
Anonymous Maarten 2024-06-25 15:03:53 +02:00
parent a226f5d59e
commit 3aa22e2077
3 changed files with 25 additions and 4 deletions

View File

@ -7,17 +7,23 @@
#include "mxstl/stlcompat.h" #include "mxstl/stlcompat.h"
#include "mxtypes.h" #include "mxtypes.h"
#if defined(_M_IX86) || defined(__i386__)
#define COMPARE_POINTER_TYPE MxS32
#else
#define COMPARE_POINTER_TYPE MxS32*
#endif
struct LegoPathActorSetCompare { struct LegoPathActorSetCompare {
MxU32 operator()(const LegoPathActor* p_lhs, const LegoPathActor* p_rhs) const MxU32 operator()(const LegoPathActor* p_lhs, const LegoPathActor* p_rhs) const
{ {
return (MxS32) p_lhs < (MxS32) p_rhs; return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs;
} }
}; };
struct LegoAnimPresenterSetCompare { struct LegoAnimPresenterSetCompare {
MxBool operator()(const LegoAnimPresenter* p_lhs, const LegoAnimPresenter* p_rhs) const MxBool operator()(const LegoAnimPresenter* p_lhs, const LegoAnimPresenter* p_rhs) const
{ {
return (MxS32) p_lhs < (MxS32) p_rhs; return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs;
} }
}; };

View File

@ -14,6 +14,12 @@ class LegoWorld;
class MxAtomId; class MxAtomId;
class Vector3; class Vector3;
#if defined(_M_IX86) || defined(__i386__)
#define COMPARE_POINTER_TYPE MxS32
#else
#define COMPARE_POINTER_TYPE MxS32*
#endif
// VTABLE: LEGO1 0x100d7da8 // VTABLE: LEGO1 0x100d7da8
// SIZE 0x40 // SIZE 0x40
struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {}; struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {};
@ -21,7 +27,7 @@ struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {};
struct LegoPathCtrlEdgeCompare { struct LegoPathCtrlEdgeCompare {
MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const
{ {
return (MxS32) p_lhs < (MxS32) p_rhs; return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs;
} }
}; };

View File

@ -12,8 +12,17 @@ class LegoEntityList;
class LegoPathBoundary; class LegoPathBoundary;
class LegoHideAnimPresenter; class LegoHideAnimPresenter;
#if defined(_M_IX86) || defined(__i386__)
#define COMPARE_POINTER_TYPE MxS32
#else
#define COMPARE_POINTER_TYPE MxS32*
#endif
struct CoreSetCompare { struct CoreSetCompare {
MxS32 operator()(MxCore* const& p_a, MxCore* const& p_b) const { return (MxS32) p_a < (MxS32) p_b; } MxS32 operator()(MxCore* const& p_a, MxCore* const& p_b) const
{
return (COMPARE_POINTER_TYPE) p_a < (COMPARE_POINTER_TYPE) p_b;
}
}; };
typedef set<MxCore*, CoreSetCompare> MxCoreSet; typedef set<MxCore*, CoreSetCompare> MxCoreSet;