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
This commit is contained in:
Jesse Talavera-Greenberg
2023-11-25 12:32:09 -05:00
committed by GitHub
parent 651b0f680c
commit 346dd4006e
178 changed files with 529 additions and 268 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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>;

View File

@ -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);

View File

@ -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));
}
}
}

View File

@ -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__

View File

@ -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.

View File

@ -19,6 +19,8 @@
namespace Gen
{
using namespace melonDS;
using namespace Common;
enum CCFlags
{
CC_O = 0,