summaryrefslogtreecommitdiff
path: root/sim/arm/armsupp.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2000-01-26 21:49:14 +0000
committerJason Molenda <jmolenda@apple.com>2000-01-26 21:49:14 +0000
commitf743149ecb74d161c7be3171d36bafc805473ebc (patch)
treedbc3f2cbbcc2d0d35b57b4702caaac431a1288a8 /sim/arm/armsupp.c
parentcb268829510cffcfdefd0ac26118216321be2039 (diff)
downloadbinutils-gdb-f743149ecb74d161c7be3171d36bafc805473ebc.tar.gz
import gdb-2000-01-26 snapshot
Diffstat (limited to 'sim/arm/armsupp.c')
-rw-r--r--sim/arm/armsupp.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sim/arm/armsupp.c b/sim/arm/armsupp.c
index 67edd95594d..4979fd8150b 100644
--- a/sim/arm/armsupp.c
+++ b/sim/arm/armsupp.c
@@ -391,6 +391,20 @@ void ARMul_NegZero(ARMul_State *state, ARMword result)
else { CLEARN ; CLEARZ ; } ;
}
+/* Compute whether an addition of A and B, giving RESULT, overflowed. */
+int AddOverflow (ARMword a, ARMword b, ARMword result)
+{
+ return ((NEG (a) && NEG (b) && POS (result))
+ || (POS (a) && POS (b) && NEG (result)));
+}
+
+/* Compute whether a subtraction of A and B, giving RESULT, overflowed. */
+int SubOverflow (ARMword a, ARMword b, ARMword result)
+{
+ return ((NEG (a) && POS (b) && POS (result))
+ || (POS (a) && NEG (b) && NEG (result)));
+}
+
/***************************************************************************\
* Assigns the C flag after an addition of a and b to give result *
\***************************************************************************/
@@ -408,9 +422,8 @@ void ARMul_AddCarry(ARMul_State *state, ARMword a,ARMword b,ARMword result)
void ARMul_AddOverflow(ARMul_State *state, ARMword a,ARMword b,ARMword result)
{
- ASSIGNV( (NEG(a) && NEG(b) && POS(result)) ||
- (POS(a) && POS(b) && NEG(result)) ) ;
- }
+ ASSIGNV (AddOverflow (a, b, result));
+}
/***************************************************************************\
* Assigns the C flag after an subtraction of a and b to give result *
@@ -429,8 +442,7 @@ ASSIGNC( (NEG(a) && POS(b)) ||
void ARMul_SubOverflow(ARMul_State *state,ARMword a,ARMword b,ARMword result)
{
-ASSIGNV( (NEG(a) && POS(b) && POS(result)) ||
- (POS(a) && NEG(b) && NEG(result)) ) ;
+ ASSIGNV (SubOverflow (a, b, result));
}
/***************************************************************************\