Use the precomputed sets_min_1 value consistently when masking
off bits from an address to find which cache set it is in.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11809 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_sim.c b/cachegrind/cg_sim.c
index 0b8a1d7..d465bb3 100644
--- a/cachegrind/cg_sim.c
+++ b/cachegrind/cg_sim.c
@@ -139,7 +139,7 @@
\
/* Second case: word straddles two lines. */ \
/* Nb: this is a fast way of doing ((set1+1) % L.sets) */ \
- } else if (((set1 + 1) & (L.sets-1)) == set2) { \
+ } else if (((set1 + 1) & (L.sets_min_1)) == set2) { \
set = &(L.tags[set1 * L.assoc]); \
if (tag == set[0]) { \
goto block2; \
diff --git a/callgrind/sim.c b/callgrind/sim.c
index 60b2987..26f14be 100644
--- a/callgrind/sim.c
+++ b/callgrind/sim.c
@@ -286,7 +286,7 @@
/* Access straddles two lines. */
/* Nb: this is a fast way of doing ((set1+1) % c->sets) */
- else if (((set1 + 1) & (c->sets-1)) == set2) {
+ else if (((set1 + 1) & (c->sets_min_1)) == set2) {
UWord tag2 = (a+size-1) >> c->tag_shift;
/* the call updates cache structures as side effect */
@@ -390,7 +390,7 @@
/* Access straddles two lines. */
/* Nb: this is a fast way of doing ((set1+1) % c->sets) */
- else if (((set1 + 1) & (c->sets-1)) == set2) {
+ else if (((set1 + 1) & (c->sets_min_1)) == set2) {
UWord tag2 = (a+size-1) & c->tag_mask;
/* the call updates cache structures as side effect */
@@ -735,7 +735,7 @@
\
/* Second case: word straddles two lines. */ \
/* Nb: this is a fast way of doing ((set1+1) % L.sets) */ \
- } else if (((set1 + 1) & (L.sets-1)) == set2) { \
+ } else if (((set1 + 1) & (L.sets_min_1)) == set2) { \
Int miss1=0, miss2=0; /* 0: L1 hit, 1:L1 miss, 2:LL miss */ \
set = &(L.tags[set1 * L.assoc]); \
use_mask = L.line_start_mask[a & L.line_size_mask]; \