diff options
Diffstat (limited to 'src/core/hw/lcd.h')
| -rw-r--r-- | src/core/hw/lcd.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h index 57029c5e8..404833165 100644 --- a/src/core/hw/lcd.h +++ b/src/core/hw/lcd.h | |||
| @@ -42,16 +42,15 @@ struct Regs { | |||
| 42 | return sizeof(Regs) / sizeof(u32); | 42 | return sizeof(Regs) / sizeof(u32); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | const u32& operator [] (int index) const { | 45 | const u32& operator[](int index) const { |
| 46 | const u32* content = reinterpret_cast<const u32*>(this); | 46 | const u32* content = reinterpret_cast<const u32*>(this); |
| 47 | return content[index]; | 47 | return content[index]; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | u32& operator [] (int index) { | 50 | u32& operator[](int index) { |
| 51 | u32* content = reinterpret_cast<u32*>(this); | 51 | u32* content = reinterpret_cast<u32*>(this); |
| 52 | return content[index]; | 52 | return content[index]; |
| 53 | } | 53 | } |
| 54 | |||
| 55 | }; | 54 | }; |
| 56 | static_assert(std::is_standard_layout<Regs>::value, "Structure does not use standard layout"); | 55 | static_assert(std::is_standard_layout<Regs>::value, "Structure does not use standard layout"); |
| 57 | 56 | ||
| @@ -59,14 +58,14 @@ static_assert(std::is_standard_layout<Regs>::value, "Structure does not use stan | |||
| 59 | // is technically allowed since C++11. This macro should be enabled once MSVC adds | 58 | // is technically allowed since C++11. This macro should be enabled once MSVC adds |
| 60 | // support for that. | 59 | // support for that. |
| 61 | #ifndef _MSC_VER | 60 | #ifndef _MSC_VER |
| 62 | #define ASSERT_REG_POSITION(field_name, position) \ | 61 | #define ASSERT_REG_POSITION(field_name, position) \ |
| 63 | static_assert(offsetof(Regs, field_name) == position * 4, \ | 62 | static_assert(offsetof(Regs, field_name) == position * 4, \ |
| 64 | "Field "#field_name" has invalid position") | 63 | "Field " #field_name " has invalid position") |
| 65 | 64 | ||
| 66 | ASSERT_REG_POSITION(color_fill_top, 0x81); | 65 | ASSERT_REG_POSITION(color_fill_top, 0x81); |
| 67 | ASSERT_REG_POSITION(backlight_top, 0x90); | 66 | ASSERT_REG_POSITION(backlight_top, 0x90); |
| 68 | ASSERT_REG_POSITION(color_fill_bottom, 0x281); | 67 | ASSERT_REG_POSITION(color_fill_bottom, 0x281); |
| 69 | ASSERT_REG_POSITION(backlight_bottom, 0x290); | 68 | ASSERT_REG_POSITION(backlight_bottom, 0x290); |
| 70 | 69 | ||
| 71 | #undef ASSERT_REG_POSITION | 70 | #undef ASSERT_REG_POSITION |
| 72 | #endif // !defined(_MSC_VER) | 71 | #endif // !defined(_MSC_VER) |
| @@ -74,7 +73,7 @@ ASSERT_REG_POSITION(backlight_bottom, 0x290); | |||
| 74 | extern Regs g_regs; | 73 | extern Regs g_regs; |
| 75 | 74 | ||
| 76 | template <typename T> | 75 | template <typename T> |
| 77 | void Read(T &var, const u32 addr); | 76 | void Read(T& var, const u32 addr); |
| 78 | 77 | ||
| 79 | template <typename T> | 78 | template <typename T> |
| 80 | void Write(u32 addr, const T data); | 79 | void Write(u32 addr, const T data); |