summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-03-15 23:21:01 -0400
committerAli Saidi <saidi@eecs.umich.edu>2007-03-15 23:21:01 -0400
commita18baae02638f1abc627edc63570878659082108 (patch)
treeef1e29aac051283bad5160cf7d5378c9d1e1c587
parentff90b8c1aa99711eeb55c5eba29519f77cbc041c (diff)
downloadgem5-a18baae02638f1abc627edc63570878659082108.tar.xz
fix a bug gabe found
--HG-- extra : convert_revision : 12e8f09f6c59a16b2d2eb78bdd1345fc38c4de40
-rw-r--r--src/base/bitfield.hh17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/base/bitfield.hh b/src/base/bitfield.hh
index 83b9138b4..79dbcc86c 100644
--- a/src/base/bitfield.hh
+++ b/src/base/bitfield.hh
@@ -121,17 +121,12 @@ findMsbSet(uint64_t val) {
int msb = 0;
if (!val)
return 0;
- if (bits(val, 63,32)) msb += 32;
- val >>= 32;
- if (bits(val, 31,16)) msb += 16;
- val >>= 16;
- if (bits(val, 15,8)) msb += 8;
- val >>= 8;
- if (bits(val, 7,4)) msb += 4;
- val >>= 4;
- if (bits(val, 3,2)) msb += 2;
- val >>= 2;
- if (bits(val, 1,1)) msb += 1;
+ if (bits(val, 63,32)) { msb += 32; val >>= 32; }
+ if (bits(val, 31,16)) { msb += 16; val >>= 16; }
+ if (bits(val, 15,8)) { msb += 8; val >>= 8; }
+ if (bits(val, 7,4)) { msb += 4; val >>= 4; }
+ if (bits(val, 3,2)) { msb += 2; val >>= 2; }
+ if (bits(val, 1,1)) { msb += 1; }
return msb;
}