fusion: Don't assume a specific compiler behaviour

André Hentschel nerv at dawncrow.de
Thu Jul 19 14:49:14 CDT 2012


maybe it's some braindamage by me, but when i is greater or equal to 32 a shift of HighPart by e.g. 33 doesn't make much sense. For some reason this works on x86 but not on ARM. Most likely it's rotated on x86 and hardly shifted on ARM, damn compilers.
If i'm right i don't want to know how much places there are in Wine with assumptions like this, i'll most likely find them with the testsuite on ARM, but i's quite hard to get to the point where you see them...
---
 dlls/fusion/assembly.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/fusion/assembly.c b/dlls/fusion/assembly.c
index d04ba73..8e6bfcb 100644
--- a/dlls/fusion/assembly.c
+++ b/dlls/fusion/assembly.c
@@ -506,7 +506,7 @@ static HRESULT parse_clr_tables(ASSEMBLY *assembly, ULONG offset)
     for (i = 0; i < MAX_CLR_TABLES; i++)
     {
         if ((i < 32 && (assembly->tableshdr->MaskValid.u.LowPart >> i) & 1) ||
-            (i >= 32 && (assembly->tableshdr->MaskValid.u.HighPart >> i) & 1))
+            (i >= 32 && (assembly->tableshdr->MaskValid.u.HighPart >> (i-32)) & 1))
         {
             assembly->numtables++;
         }
@@ -522,7 +522,7 @@ static HRESULT parse_clr_tables(ASSEMBLY *assembly, ULONG offset)
     for (i = 0; i < MAX_CLR_TABLES; i++)
     {
         if ((i < 32 && (assembly->tableshdr->MaskValid.u.LowPart >> i) & 1) ||
-            (i >= 32 && (assembly->tableshdr->MaskValid.u.HighPart >> i) & 1))
+            (i >= 32 && (assembly->tableshdr->MaskValid.u.HighPart >> (i-32)) & 1))
         {
             assembly->tables[i].rows = assembly->numrows[offidx];
             offidx++;
@@ -534,7 +534,7 @@ static HRESULT parse_clr_tables(ASSEMBLY *assembly, ULONG offset)
     for (i = 1; i < MAX_CLR_TABLES; i++)
     {
         if ((i < 32 && (assembly->tableshdr->MaskValid.u.LowPart >> i) & 1) ||
-            (i >= 32 && (assembly->tableshdr->MaskValid.u.HighPart >> i) & 1))
+            (i >= 32 && (assembly->tableshdr->MaskValid.u.HighPart >> (i-32)) & 1))
         {
             currofs += get_table_size(assembly, previ) * assembly->numrows[offidx - 1];
             assembly->tables[i].offset = currofs;
-- 
1.7.4.1


-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list