base: Clean up condcodes.hh slightly.
authorGabe Black <gabeblack@google.com>
Sun, 8 Mar 2020 04:10:46 +0000 (20:10 -0800)
committerGabe Black <gabeblack@google.com>
Mon, 9 Mar 2020 00:48:08 +0000 (00:48 +0000)
Correct some minor style issues, make the functions static, and use the
single bit version of bits.

Change-Id: I4708961745a33caabecfbb06f8113ce8980e399e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26424
Reviewed-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/base/condcodes.hh

index 2980a1478ff10b0d0a23b5e6045f68c7255e8090..5de2daa77374687b799cec1ca552e1438568aad4 100644 (file)
@@ -30,7 +30,6 @@
 #define __BASE_CONDCODE_HH__
 
 #include "base/bitfield.hh"
-#include "base/trace.hh"
 
 /**
  * Calculate the carry flag from an addition. This should work even when
@@ -76,9 +75,9 @@
  *     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) +
@@ -88,9 +87,9 @@ findCarry(int width, uint64_t dest, uint64_t src1, uint64_t src2) {
 /**
  * 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);
 }
@@ -111,9 +110,9 @@ findOverflow(int width, uint64_t dest, uint64_t src1, uint64_t src2) {
  *   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);
@@ -127,18 +126,18 @@ findParity(int width, uint64_t dest) {
 /**
  * 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));
 }