Prechádzať zdrojové kódy

core/video_core: Don't cast away const in subscript operators

Not to say these subscript operators aren't totally ugly as is.
Lioncash 10 rokov pred
rodič
commit
39baad9926
3 zmenil súbory, kde vykonal 9 pridanie a 9 odobranie
  1. 3 3
      src/core/hw/gpu.h
  2. 3 3
      src/core/hw/lcd.h
  3. 3 3
      src/video_core/pica.h

+ 3 - 3
src/core/hw/gpu.h

@@ -267,13 +267,13 @@ struct Regs {
         return sizeof(Regs) / sizeof(u32);
     }
 
-    u32& operator [] (int index) const {
-        u32* content = (u32*)this;
+    const u32& operator [] (int index) const {
+        const u32* content = reinterpret_cast<const u32*>(this);
         return content[index];
     }
 
     u32& operator [] (int index) {
-        u32* content = (u32*)this;
+        u32* content = reinterpret_cast<u32*>(this);
         return content[index];
     }
 

+ 3 - 3
src/core/hw/lcd.h

@@ -42,13 +42,13 @@ struct Regs {
         return sizeof(Regs) / sizeof(u32);
     }
 
-    u32& operator [] (int index) const {
-        u32* content = (u32*)this;
+    const u32& operator [] (int index) const {
+        const u32* content = reinterpret_cast<const u32*>(this);
         return content[index];
     }
 
     u32& operator [] (int index) {
-        u32* content = (u32*)this;
+        u32* content = reinterpret_cast<u32*>(this);
         return content[index];
     }
 

+ 3 - 3
src/video_core/pica.h

@@ -1225,13 +1225,13 @@ struct Regs {
         return sizeof(Regs) / sizeof(u32);
     }
 
-    u32& operator [] (int index) const {
-        u32* content = (u32*)this;
+    const u32& operator [] (int index) const {
+        const u32* content = reinterpret_cast<const u32*>(this);
         return content[index];
     }
 
     u32& operator [] (int index) {
-        u32* content = (u32*)this;
+        u32* content = reinterpret_cast<u32*>(this);
         return content[index];
     }