Author: aandrejevic
Date: Mon Jun  8 15:56:19 2015
New Revision: 68079

URL: http://svn.reactos.org/svn/reactos?rev=68079&view=rev
Log:
[FAST486]
Add constants for numeric limits.


Modified:
    trunk/reactos/include/reactos/libs/fast486/fast486.h
    trunk/reactos/lib/fast486/opcodes.c
    trunk/reactos/lib/fast486/opgroups.c

Modified: trunk/reactos/include/reactos/libs/fast486/fast486.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/fast486/fast486.h?rev=68079&r1=68078&r2=68079&view=diff
==============================================================================
--- trunk/reactos/include/reactos/libs/fast486/fast486.h        [iso-8859-1] 
(original)
+++ trunk/reactos/include/reactos/libs/fast486/fast486.h        [iso-8859-1] 
Mon Jun  8 15:56:19 2015
@@ -29,6 +29,13 @@
 #ifndef FASTCALL
 #define FASTCALL __fastcall
 #endif
+
+#define FAST486_CHAR_MIN  (-128)
+#define FAST486_CHAR_MAX  (127)
+#define FAST486_SHORT_MIN (-32768L)
+#define FAST486_SHORT_MAX (32767L)
+#define FAST486_LONG_MIN  (-2147483648LL)
+#define FAST486_LONG_MAX  (2147483647LL)
 
 #define FAST486_NUM_GEN_REGS    8
 #define FAST486_NUM_SEG_REGS    6

Modified: trunk/reactos/lib/fast486/opcodes.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/opcodes.c?rev=68079&r1=68078&r2=68079&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/opcodes.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/opcodes.c [iso-8859-1] Mon Jun  8 15:56:19 2015
@@ -3532,7 +3532,8 @@
         Product = (LONGLONG)Multiplicand * (LONGLONG)Multiplier;
 
         /* Check for carry/overflow */
-        State->Flags.Cf = State->Flags.Of = ((Product < -2147483648LL) || 
(Product > 2147483647LL));
+        State->Flags.Cf = State->Flags.Of = ((Product < FAST486_LONG_MIN)
+                                            || (Product > FAST486_LONG_MAX));
 
         /* Write-back the result */
         Fast486WriteModrmDwordOperands(State,
@@ -3559,7 +3560,8 @@
         Product = (LONG)Multiplicand * (LONG)Multiplier;
 
         /* Check for carry/overflow */
-        State->Flags.Cf = State->Flags.Of = ((Product < -32768) || (Product > 
32767));
+        State->Flags.Cf = State->Flags.Of = ((Product < FAST486_SHORT_MIN)
+                                            || (Product > FAST486_SHORT_MAX));
 
         /* Write-back the result */
         Fast486WriteModrmWordOperands(State,

Modified: trunk/reactos/lib/fast486/opgroups.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/opgroups.c?rev=68079&r1=68078&r2=68079&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/opgroups.c        [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/opgroups.c        [iso-8859-1] Mon Jun  8 
15:56:19 2015
@@ -969,7 +969,7 @@
             SHORT Result = (SHORT)((CHAR)Value) * 
(SHORT)((CHAR)State->GeneralRegs[FAST486_REG_EAX].LowByte);
 
             /* Update the flags */
-            State->Flags.Cf = State->Flags.Of = ((Result < -128) || (Result > 
127));
+            State->Flags.Cf = State->Flags.Of = ((Result < FAST486_CHAR_MIN) 
|| (Result > FAST486_CHAR_MAX));
 
             /* Write back the result */
             State->GeneralRegs[FAST486_REG_EAX].LowWord = (USHORT)Result;
@@ -1023,7 +1023,7 @@
             Quotient = (SHORT)State->GeneralRegs[FAST486_REG_EAX].LowWord / 
(CHAR)Value;
             Remainder = (SHORT)State->GeneralRegs[FAST486_REG_EAX].LowWord % 
(CHAR)Value;
 
-            if (Quotient > 127 || Quotient < -128)
+            if (Quotient > FAST486_CHAR_MAX || Quotient < FAST486_CHAR_MIN)
             {
                 /* Divide error */
                 Fast486Exception(State, FAST486_EXCEPTION_DE);
@@ -1205,7 +1205,7 @@
                 LONGLONG Result = (LONGLONG)((LONG)Value) * 
(LONGLONG)((LONG)State->GeneralRegs[FAST486_REG_EAX].Long);
 
                 /* Update the flags */
-                State->Flags.Cf = State->Flags.Of = ((Result < -2147483648LL) 
|| (Result > 2147483647LL));
+                State->Flags.Cf = State->Flags.Of = ((Result < 
FAST486_LONG_MIN) || (Result > FAST486_LONG_MAX));
 
                 /* Write back the result */
                 State->GeneralRegs[FAST486_REG_EAX].Long = Result & 
0xFFFFFFFFULL;
@@ -1216,7 +1216,7 @@
                 LONG Result = (LONG)((SHORT)Value) * 
(LONG)((SHORT)State->GeneralRegs[FAST486_REG_EAX].LowWord);
 
                 /* Update the flags */
-                State->Flags.Cf = State->Flags.Of = ((Result < -32768) || 
(Result > 32767));
+                State->Flags.Cf = State->Flags.Of = ((Result < 
FAST486_SHORT_MIN) || (Result > FAST486_SHORT_MAX));
 
                 /* Write back the result */
                 State->GeneralRegs[FAST486_REG_EAX].LowWord = LOWORD(Result);
@@ -1293,7 +1293,7 @@
                 LONGLONG Quotient = Dividend / (LONG)Value;
                 LONG Remainder = Dividend % (LONG)Value;
 
-                if (Quotient > 2147483647LL || Quotient < -2147483648LL)
+                if (Quotient > FAST486_LONG_MAX || Quotient < FAST486_LONG_MIN)
                 {
                     /* Divide error */
                     Fast486Exception(State, FAST486_EXCEPTION_DE);
@@ -1311,7 +1311,7 @@
                 LONG Quotient = Dividend / (SHORT)LOWORD(Value);
                 SHORT Remainder = Dividend % (SHORT)LOWORD(Value);
 
-                if (Quotient > 32767 || Quotient < -32768)
+                if (Quotient > FAST486_SHORT_MAX || Quotient < 
FAST486_SHORT_MIN)
                 {
                     /* Divide error */
                     Fast486Exception(State, FAST486_EXCEPTION_DE);


Reply via email to