Commits

Marianne Gagnon committed 40b90b8

Apply patch by Neive to improve 64-bits build

Comments (0)

Files changed (1)

debugger/memorysearch.cpp

         {
             memcpy(&realdata, data_, len); // This way allows using extra size of 64-bit architechture pointers,
             data = (uint8_t *)&realdata;   // but hardcoding len as 4 would optimize better
-        }                                  // (And this program won't likely ever be compiled as 64bit?)
+        }
         else
         {
             realdata = (uint8_t *)malloc(len);
     {
         if (((length + 4) & ~0x3) <= sizeof(uint8_t))
         {
-            memcpy(&realdata, (void *)((uint32_t)data_ & ~0x3), (length + 4) & ~0x3);
+            memcpy(&realdata, (void *)((uintptr_t)data_ & ~0x3), (length + 4) & ~0x3);
             data = (uint8_t *)&realdata + (start_address & 0x3);
         }
         else
         {
             realdata = (uint8_t *)malloc((length + 4) & ~0x3);
-            memcpy(realdata, (void *)((uint32_t)data_ & ~0x3), (length + 4) & ~0x3);
+            memcpy(realdata, (void *)((uintptr_t)data_ & ~0x3), (length + 4) & ~0x3);
             data = realdata + (start_address & 0x3);
         }
     }
     realdata = other.realdata;
     start_address = other.start_address;
     length = other.length;
-    if (((uint32_t)other.data & ~0x3) == (uint32_t)&other.realdata)
+    if (((uintptr_t)other.data & ~0x3) == (uintptr_t)&other.realdata)
         data = (uint8_t *)&realdata;
     else
         data = other.data;
     start_address = other.start_address;
     length = other.length;
     realdata = other.realdata;
-    if (((uint32_t)other.data & ~0x3) == (uint32_t)&other.realdata)
+    if (((uintptr_t)other.data & ~0x3) == (uintptr_t)&other.realdata)
         data = (uint8_t *)&realdata;
     else
         data = other.data;
 
 MemChunk::~MemChunk()
 {
-    if (realdata && (((uint32_t)data & ~0x3) != (uint32_t)&realdata))
+    if (realdata && (((uintptr_t)data & ~0x3) != (uintptr_t)&realdata))
         free(realdata);
 }
 
     MemSearchResult base;
     uint8_t *rdram = (uint8_t *)GetMemoryPointer(M64P_DBG_PTR_RDRAM);
     if ((end - beg + 1) & 0x3)
-        base.AddChunk((void *)((uint32_t)(rdram + beg) & ~0x3), (end - beg + 5) & ~0x3 , beg & ~0x3);
+        base.AddChunk((void *)((uintptr_t)(rdram + beg) & ~0x3), (end - beg + 5) & ~0x3 , beg & ~0x3);
     else
-        base.AddChunk((void *)((uint32_t)(rdram + beg) & ~0x3), end - beg + 1, beg & ~0x3);
+        base.AddChunk((void *)((uintptr_t)(rdram + beg) & ~0x3), end - beg + 1, beg & ~0x3);
 
     undo_list.push_back(move(base));
     undo_memusage += (end - beg + 1);
 template<>
 int8_t magicswap<int8_t>(uint8_t *pointer)
 {
-    return *(int8_t *)((uint32_t)pointer ^ 3);
+    return *(int8_t *)((uintptr_t)pointer ^ 3);
 }
 
 template<>
 uint8_t magicswap<uint8_t>(uint8_t *pointer)
 {
-    return *(uint8_t *)((uint32_t)pointer ^ 3);
+    return *(uint8_t *)((uintptr_t)pointer ^ 3);
 }
 
 template<>
 int16_t magicswap<int16_t>(uint8_t *pointer)
 {
-    return *(int16_t *)((uint32_t)pointer ^ 2);
+    return *(int16_t *)((uintptr_t)pointer ^ 2);
 }
 
 template<>
 uint16_t magicswap<uint16_t>(uint8_t *pointer)
 {
-    return *(uint16_t *)((uint32_t)pointer ^ 2);
+    return *(uint16_t *)((uintptr_t)pointer ^ 2);
 }
 
 template<>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.