[Mono-devel-list] Mono.Math/BigInteger.cs patch - looks like a mcs bug instead - and found a HP oddity too.

Paolo Molaro lupus at ximian.com
Thu Sep 4 10:38:51 EDT 2003


On 09/03/03 Bernie Solomon wrote:
> csc generates:
> 
>        IL_0000: ldc.i4.1
>        IL_0001: stloc.0
>        IL_0002: ldc.i4.s 0xfffffff0
>        IL_0004: stloc.1
>        IL_0005: ldloc.0
>        IL_0006: ldloc.1
>        IL_0007: ldc.i4.s 0x1f
>        IL_0009: and
>        IL_000a: shl
> 
> whereas mcs generates:
> 
>         IL_0000: ldc.i4.1
>         IL_0001: stloc.0
>         IL_0002: ldc.i4.s 0xfffffff0
>         IL_0004: stloc.1
>         IL_0005: ldloc.0
>         IL_0006: ldloc.1
>         IL_0007: shl
> 
> - note the missing & with 31. The shl spec for the CLR says:
> 
>       The return value is unspecified if shiftAmount is greater than or
> equal to the width of value
> 
> Though the C# spec is more specific:
>     If expr is an int or uint (32-bit quantity), the shift count is given by
> the low-order five bits of count (count & 0x1f).

See bug http://bugzilla.ximian.com/show_bug.cgi?id=31673.
I couldn't find the C# chapter and verse for miguel, so he ignored the
issue:-)
I'll reopen the bug.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list