[FAST486]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Sun, 10 Nov 2013 03:11:56 +0000 (03:11 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Sun, 10 Nov 2013 03:11:56 +0000 (03:11 +0000)
The number of bit places in a shift operation is ANDed by the width of the type
when it is in a register, so (1 << c), when c is 32, is actually 1, and not 0.
Fix the calculation of MaxValue by using SignFlag | (SignFlag - 1) instead.

svn path=/branches/ntvdm/; revision=60912

lib/fast486/opgroups.c

index b786d39..f29bf51 100644 (file)
@@ -43,7 +43,7 @@ Fast486ArithmeticOperation(PFAST486_STATE State,
 {
     ULONG Result;
     ULONG SignFlag = 1 << (Bits - 1);
-    ULONG MaxValue = (1 << Bits) - 1;
+    ULONG MaxValue = (SignFlag - 1) | SignFlag;
 
     /* Make sure the values don't exceed the maximum for their size */
     FirstValue &= MaxValue;