summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-07-20 14:54:17 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-07-20 14:54:17 -0700
commitee22bcd60940ed8cd23865e40ed8debc6c1f4288 (patch)
tree30aa4029677abd7f8e1fb6f98c8154019110d60d /src/base
parent0baae59c0902d17158fc592bf4dbd0e97fe6d33e (diff)
downloadgem5-ee22bcd60940ed8cd23865e40ed8debc6c1f4288.tar.xz
Fix function which calculates the carry flag.
--HG-- extra : convert_revision : aeb4f2d4c3936089421dbe80647f28ae36178283
Diffstat (limited to 'src/base')
-rw-r--r--src/base/condcodes.hh5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/base/condcodes.hh b/src/base/condcodes.hh
index 10109e4ad..efff12dc8 100644
--- a/src/base/condcodes.hh
+++ b/src/base/condcodes.hh
@@ -32,6 +32,7 @@
#define __BASE_CONDCODE_HH__
#include "base/bitfield.hh"
+#include "base/trace.hh"
/**
* Calculate the carry flag from an addition. This should work even when
@@ -41,7 +42,9 @@ inline
bool
findCarry(int width, uint64_t dest, uint64_t src1, uint64_t src2) {
int shift = width - 1;
- return (~(dest >> shift) + (src1 >> shift) + (src2 >> shift)) & 0x2;
+ return ((~(dest >> shift) & 1) +
+ ((src1 >> shift) & 1) +
+ ((src2 >> shift) & 1)) & 0x2;
}
/**