fusion: Don't assume a specific compiler behaviour

Ruslan Kabatsayev b7.10110111 at gmail.com
Thu Jul 19 15:06:58 CDT 2012


Hello,

> Most likely it's rotated on x86 and hardly shifted on ARM, damn compilers.
No, it's not compilers, it's intel's "shr" instruction behavior: it
masks bit count lower 5 bits, thus making 33 effectively 1.
Corresponding ARM instruction most likely does true 33 bit shift
giving you zero result.

Regards,
Ruslan

PS I didn't look at types your patch works on, but be careful to not
mess up 64 bit types this way.

On Thu, Jul 19, 2012 at 11:49 PM, André Hentschel <nerv at dawncrow.de> wrote:
> 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-devel mailing list