From 2024024bf19a0818efd89166a27e6f11b8d5c32a Mon Sep 17 00:00:00 2001 From: Jaby Date: Sun, 11 Sep 2022 12:06:40 +0200 Subject: [PATCH] Fixed bug and spread some always_inlines --- include/PSX/Auxiliary/complex_bitmap.hpp | 32 ++++++++++++------------ include/PSX/System/IOPorts/GPU_IO.hpp | 4 +-- include/PSX/System/IOPorts/IOPort.hpp | 8 +++--- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/PSX/Auxiliary/complex_bitmap.hpp b/include/PSX/Auxiliary/complex_bitmap.hpp index 95c421ae..5d5b38a7 100644 --- a/include/PSX/Auxiliary/complex_bitmap.hpp +++ b/include/PSX/Auxiliary/complex_bitmap.hpp @@ -62,89 +62,89 @@ public: private: template - constexpr ComplexBitMap& set_va(const S& value) { + constexpr __always_inline ComplexBitMap& set_va(const S& value) { return this->set(value); } template - constexpr ComplexBitMap& set_va(const S& value, const ARGS&...args) { + constexpr __always_inline ComplexBitMap& set_va(const S& value, const ARGS&...args) { return this->set_va(value).set_va(args...); } public: template - static constexpr ComplexBitMap with(ARGS...args) { + static constexpr __always_inline ComplexBitMap with(ARGS...args) { return ComplexBitMap().set_va(args...); } //Accesssing bits template - constexpr ComplexBitMap& set_bit(S bit) { + constexpr __always_inline ComplexBitMap& set_bit(S bit) { this->raw = bit::set(this->raw, static_cast(bit)); return *this; } template - constexpr ComplexBitMap& clear_bit(S bit) { + constexpr __always_inline ComplexBitMap& clear_bit(S bit) { this->raw = bit::clear(this->raw, static_cast(bit)); return *this; } template - constexpr bool is_bit_set(S bit) { + constexpr __always_inline bool is_bit_set(S bit) { return bit::is_set(this->raw, static_cast(bit)); } //Accessing values template - constexpr ComplexBitMap& set_value(S value, const BitRange& range) { + constexpr __always_inline ComplexBitMap& set_value(S value, const BitRange& range) { this->raw = bit::value::set_normalized(this->raw, static_cast(value), range.begin, range.length); return *this; } template - constexpr ComplexBitMap& clear_value(const BitRange& range) { + constexpr __always_inline ComplexBitMap& clear_value(const BitRange& range) { this->raw = bit::value::clear_normalized(this->raw, range.begin, range.length); return *this; } template - constexpr S get_value(const BitRange& range) { + constexpr __always_inline S get_value(const BitRange& range) { return static_cast(bit::value::get_normalized(this->raw, range.begin, range.length)); } // For easier constructing - constexpr ComplexBitMap& set(const BitRange& range, T value) { + constexpr __always_inline ComplexBitMap& set(const BitRange& range, T value) { this->set_value(value, range); return *this; } - constexpr ComplexBitMap& set(const BitRangeValue& value) { + constexpr __always_inline ComplexBitMap& set(const BitRangeValue& value) { this->set_value(value.value, {value.begin, value.length}); return *this; } - constexpr ComplexBitMap& set(const Bit& bit) { + constexpr __always_inline ComplexBitMap& set(const Bit& bit) { this->set_bit(bit.value); return *this; } - constexpr ComplexBitMap& set(const ClearBitValue& value) { + constexpr __always_inline ComplexBitMap& set(const ClearBitValue& value) { this->clear_bit(value.bit); return *this; } - constexpr ComplexBitMap& operator|(const BitRangeValue& value) { + constexpr __always_inline ComplexBitMap& operator|(const BitRangeValue& value) { this->set_value(value.value, value.range); return *this; } - constexpr ComplexBitMap& operator|(const Bit& bit) { + constexpr __always_inline ComplexBitMap& operator|(const Bit& bit) { this->set_bit(bit.value); return *this; } - constexpr ComplexBitMap& operator|(const ClearBitValue& value) { + constexpr __always_inline ComplexBitMap& operator|(const ClearBitValue& value) { this->clear_bit(value.bit); return *this; } diff --git a/include/PSX/System/IOPorts/GPU_IO.hpp b/include/PSX/System/IOPorts/GPU_IO.hpp index f18270df..f53927aa 100644 --- a/include/PSX/System/IOPorts/GPU_IO.hpp +++ b/include/PSX/System/IOPorts/GPU_IO.hpp @@ -51,11 +51,11 @@ namespace GPU { } static constexpr GP0 TopLeftPosition(uint16_t x, uint16_t y) { - return ComplexBitMap{static_cast((y << 16) | x)}; + return ComplexBitMap{static_cast((y << 16u) | x)}; } static constexpr GP0 WidthHeight(uint16_t w, uint16_t h) { - return ComplexBitMap{static_cast((h << 16) | w)}; + return ComplexBitMap{static_cast((h << 16u) | w)}; } }; diff --git a/include/PSX/System/IOPorts/IOPort.hpp b/include/PSX/System/IOPorts/IOPort.hpp index b12a8680..cb095762 100644 --- a/include/PSX/System/IOPorts/IOPort.hpp +++ b/include/PSX/System/IOPorts/IOPort.hpp @@ -58,15 +58,15 @@ static constexpr uintptr_t IO_Base_Adr = 0x10000000; #define __declare_io_port_global_const(type, name, adr) __declare_io_port_global_raw(const, type, name, adr) #define __declare_io_port_global_array(type, name, adr, size) static __always_inline auto& name = reinterpret_cast(*reinterpret_cast((IO_Base_Adr + (adr & ~IO_Base_Mask)))); #define __io_port_inherit_complex_bit_map(name) \ - constexpr name() = default; \ - constexpr name(ComplexBitMap value) : ComplexBitMap(value) { \ + constexpr __always_inline name() = default; \ + constexpr __always_inline name(ComplexBitMap value) : ComplexBitMap(value) { \ } \ template \ - static constexpr name with(ARGS...args) { \ + static constexpr __always_inline name with(ARGS...args) { \ return {ComplexBitMap::with(args...)}; \ }\ template \ - constexpr void operator=(ComplexBitMap value) volatile { \ + constexpr void __always_inline operator=(ComplexBitMap value) volatile { \ this->raw = value.raw; \ }