diff options
Diffstat (limited to 'src/common/common_types.h')
-rw-r--r-- | src/common/common_types.h | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/src/common/common_types.h b/src/common/common_types.h index 1b453e7f..f6de0adf 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h @@ -47,6 +47,11 @@ typedef std::int64_t s64; ///< 64-bit signed int typedef float f32; ///< 32-bit floating point typedef double f64; ///< 64-bit floating point +// TODO: It would be nice to eventually replace these with strong types that prevent accidental +// conversion between each other. +typedef u32 VAddr; ///< Represents a pointer in the userspace virtual address space. +typedef u32 PAddr; ///< Represents a pointer in the ARM11 physical address space. + /// Union for fast 16-bit type casting union t16 { u8 _u8[2]; ///< 8-bit unsigned char(s) @@ -73,28 +78,12 @@ union t64 { u8 _u8[8]; ///< 8-bit unsigned char(s) }; -namespace Common { -/// Rectangle data structure -class Rect { -public: - Rect(int x0=0, int y0=0, int x1=0, int y1=0) { - x0_ = x0; - y0_ = y0; - x1_ = x1; - y1_ = y1; - } - ~Rect() { } - - int x0_; ///< Rect top left X-coordinate - int y0_; ///< Rect top left Y-coordinate - int x1_; ///< Rect bottom left X-coordinate - int y1_; ///< Rect bottom right Y-coordinate - - inline u32 width() const { return std::abs(x1_ - x0_); } - inline u32 height() const { return std::abs(y1_ - y0_); } +// An inheritable class to disallow the copy constructor and operator= functions +class NonCopyable { +protected: + NonCopyable() = default; + ~NonCopyable() = default; - inline bool operator == (const Rect& val) const { - return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_); - } + NonCopyable(NonCopyable&) = delete; + NonCopyable& operator=(NonCopyable&) = delete; }; -} |