diff options
author | Jesse Talavera-Greenberg <jesse@jesse.tg> | 2023-11-25 12:32:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-25 18:32:09 +0100 |
commit | 346dd4006ea1283136095d5c43f602324a095092 (patch) | |
tree | edf04631782bbfcdb48eac79b79aebb11b40f479 /src/dolphin | |
parent | 651b0f680c4531558990a5beb0e638968009dc51 (diff) |
Move all core types into namespaces (#1886)
* Reorganize namespaces
- Most types are now moved into the `melonDS` namespace
- Only good chance to do this for a while, since a big refactor is next
* Fix the build
Diffstat (limited to 'src/dolphin')
-rw-r--r-- | src/dolphin/Arm64Emitter.h | 2 | ||||
-rw-r--r-- | src/dolphin/ArmCommon.h | 2 | ||||
-rw-r--r-- | src/dolphin/BitSet.h | 10 | ||||
-rw-r--r-- | src/dolphin/MathUtil.h | 4 | ||||
-rw-r--r-- | src/dolphin/x64ABI.cpp | 6 | ||||
-rw-r--r-- | src/dolphin/x64CPUDetect.cpp | 2 | ||||
-rw-r--r-- | src/dolphin/x64Emitter.cpp | 2 | ||||
-rw-r--r-- | src/dolphin/x64Emitter.h | 2 |
8 files changed, 21 insertions, 9 deletions
diff --git a/src/dolphin/Arm64Emitter.h b/src/dolphin/Arm64Emitter.h index 0b066de..0fe4c91 100644 --- a/src/dolphin/Arm64Emitter.h +++ b/src/dolphin/Arm64Emitter.h @@ -14,6 +14,8 @@ namespace Arm64Gen { +using namespace melonDS; +using namespace Common; // X30 serves a dual purpose as a link register // Encoded as <u3:type><u5:reg> // Types: diff --git a/src/dolphin/ArmCommon.h b/src/dolphin/ArmCommon.h index 6d82e9d..cae2ecb 100644 --- a/src/dolphin/ArmCommon.h +++ b/src/dolphin/ArmCommon.h @@ -24,4 +24,4 @@ enum CCFlags CC_HS = CC_CS, // Alias of CC_CS Unsigned higher or same CC_LO = CC_CC, // Alias of CC_CC Unsigned lower }; -const u32 NO_COND = 0xE0000000; +const melonDS::u32 NO_COND = 0xE0000000; diff --git a/src/dolphin/BitSet.h b/src/dolphin/BitSet.h index 09cc1ce..424364e 100644 --- a/src/dolphin/BitSet.h +++ b/src/dolphin/BitSet.h @@ -10,6 +10,7 @@ namespace Common { +using namespace melonDS; #if defined(__GNUC__) || defined(__clang__) __attribute((always_inline)) static constexpr int CountSetBits(u8 val) { @@ -218,9 +219,10 @@ public: constexpr Iterator end() const { return Iterator(m_val, -1); } IntTy m_val; }; + +using BitSet8 = BitSet<u8>; +using BitSet16 = BitSet<u16>; +using BitSet32 = BitSet<u32>; +using BitSet64 = BitSet<u64>; } // namespace Common -using BitSet8 = Common::BitSet<u8>; -using BitSet16 = Common::BitSet<u16>; -using BitSet32 = Common::BitSet<u32>; -using BitSet64 = Common::BitSet<u64>; diff --git a/src/dolphin/MathUtil.h b/src/dolphin/MathUtil.h index b1dbbae..800a327 100644 --- a/src/dolphin/MathUtil.h +++ b/src/dolphin/MathUtil.h @@ -38,7 +38,7 @@ constexpr bool IsPow2(T imm) return imm > 0 && (imm & (imm - 1)) == 0; } -constexpr u32 NextPowerOf2(u32 value) +constexpr melonDS::u32 NextPowerOf2(melonDS::u32 value) { --value; value |= value >> 1; @@ -99,7 +99,7 @@ struct Rectangle float MathFloatVectorSum(const std::vector<float>&); // Rounds down. 0 -> undefined -inline int IntLog2(u64 val) +inline int IntLog2(melonDS::u64 val) { #if defined(__GNUC__) return 63 - __builtin_clzll(val); diff --git a/src/dolphin/x64ABI.cpp b/src/dolphin/x64ABI.cpp index d86a158..d85168a 100644 --- a/src/dolphin/x64ABI.cpp +++ b/src/dolphin/x64ABI.cpp @@ -6,8 +6,9 @@ #include "x64ABI.h" #include "x64Emitter.h" -using namespace Gen; - +namespace Gen +{ +using namespace Common; // Shared code between Win64 and Unix64 void XEmitter::ABI_CalculateFrameSize(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size, @@ -117,3 +118,4 @@ void XEmitter::MOVTwo(int bits, Gen::X64Reg dst1, Gen::X64Reg src1, s32 offset1, ADD(bits, R(dst1), Imm32(offset1)); } } +}
\ No newline at end of file diff --git a/src/dolphin/x64CPUDetect.cpp b/src/dolphin/x64CPUDetect.cpp index 49b51c9..2339048 100644 --- a/src/dolphin/x64CPUDetect.cpp +++ b/src/dolphin/x64CPUDetect.cpp @@ -17,6 +17,8 @@ #include <sys/types.h> #endif +using namespace melonDS; + static inline void __cpuidex(int info[4], int function_id, int subfunction_id) { #ifdef __FreeBSD__ diff --git a/src/dolphin/x64Emitter.cpp b/src/dolphin/x64Emitter.cpp index fd90ba7..a4543af 100644 --- a/src/dolphin/x64Emitter.cpp +++ b/src/dolphin/x64Emitter.cpp @@ -12,6 +12,8 @@ #include "Compat.h" #include "CommonFuncs.h" +using namespace melonDS; + namespace Gen { // TODO(ector): Add EAX special casing, for ever so slightly smaller code. diff --git a/src/dolphin/x64Emitter.h b/src/dolphin/x64Emitter.h index 8799600..3660321 100644 --- a/src/dolphin/x64Emitter.h +++ b/src/dolphin/x64Emitter.h @@ -19,6 +19,8 @@ namespace Gen { +using namespace melonDS; +using namespace Common; enum CCFlags { CC_O = 0, |