From 0041cc424b5711559302bd77a534922a9dbca8ae Mon Sep 17 00:00:00 2001 From: bd Date: Wed, 16 Apr 2025 15:06:04 -0400 Subject: Use signed integers for cache eviction --- src/cache.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/cache.cc b/src/cache.cc index 7092bc5..a2d4525 100644 --- a/src/cache.cc +++ b/src/cache.cc @@ -76,7 +76,7 @@ Cache::process(void *id, int address, std::function int Cache::priming_address(int address) { - unsigned int tag, index, offset; + int tag, index, offset; int r1, r2; std::array *evict; std::array *meta; @@ -109,8 +109,8 @@ Cache::priming_address(int address) return r1; } -unsigned int -Cache::is_address_missing(unsigned int index, unsigned int tag) +int +Cache::is_address_missing(int index, int tag) { int i; @@ -120,14 +120,14 @@ Cache::is_address_missing(unsigned int index, unsigned int tag) return -1; } -unsigned int -Cache::get_true_index(unsigned int index) +int +Cache::get_true_index(int index) { return index * (1 << this->ways); } -unsigned int -Cache::get_replacement_index(unsigned int index) +int +Cache::get_replacement_index(int index) { return index + (rand() % (1 << this->ways)); } -- cgit v1.2.3