#define __BASE_CONDCODE_HH__
#include "base/bitfield.hh"
-#include "base/trace.hh"
/**
* Calculate the carry flag from an addition. This should work even when
* src1 and src2 can neither be 1. So the overall result bit is 1. Hence:
* ~1 + 0 + 0 => 0. We return false.
*/
-inline
-bool
-findCarry(int width, uint64_t dest, uint64_t src1, uint64_t src2) {
+static inline bool
+findCarry(int width, uint64_t dest, uint64_t src1, uint64_t src2)
+{
int shift = width - 1;
return ((~(dest >> shift) & 1) +
((src1 >> shift) & 1) +
/**
* Calculate the overflow flag from an addition.
*/
-inline
-bool
-findOverflow(int width, uint64_t dest, uint64_t src1, uint64_t src2) {
+static inline bool
+findOverflow(int width, uint64_t dest, uint64_t src1, uint64_t src2)
+{
int shift = width - 1;
return ((src1 ^ ~src2) & (src1 ^ dest)) & (1ULL << shift);
}
* which does not have a corresponding high bit. Therefore, the value must
* have odd parity, and we return 1 accordingly. Otherwise we return 0.
*/
-inline
-bool
-findParity(int width, uint64_t dest) {
+static inline bool
+findParity(int width, uint64_t dest)
+{
dest &= mask(width);
dest ^= (dest >> 32);
dest ^= (dest >> 16);
/**
* Calculate the negative flag.
*/
-inline
-bool
-findNegative(int width, uint64_t dest) {
- return bits(dest, width - 1, width - 1);
+static inline bool
+findNegative(int width, uint64_t dest)
+{
+ return bits(dest, width - 1);
}
/**
* Calculate the zero flag.
*/
-inline
-bool
-findZero(int width, uint64_t dest) {
+static inline bool
+findZero(int width, uint64_t dest)
+{
return !(dest & mask(width));
}