mem: Tidy up CacheSet
authorAndreas Hansson <andreas.hansson@arm.com>
Fri, 4 Sep 2015 17:14:01 +0000 (13:14 -0400)
committerAndreas Hansson <andreas.hansson@arm.com>
Fri, 4 Sep 2015 17:14:01 +0000 (13:14 -0400)
Minor tweaks and house keeping.

src/mem/cache/tags/cacheset.hh

index 88e661cad74e80a88740c9cfbcd54144fe097587..71a69b3dca3b19025fec45d06287653d2bd0d753 100644 (file)
  * Declaration of an associative set
  */
 
-#ifndef __CACHESET_HH__
-#define __CACHESET_HH__
+#ifndef __MEM_CACHE_TAGS_CACHESET_HH__
+#define __MEM_CACHE_TAGS_CACHESET_HH__
 
 #include <cassert>
 
-#include "mem/cache/blk.hh" // base class
 
 /**
  * An associative set of cache blocks.
@@ -133,10 +132,7 @@ CacheSet<Blktype>::moveToHead(Blktype *blk)
 
     do {
         assert(i < assoc);
-        // swap blks[i] and next
-        Blktype *tmp = blks[i];
-        blks[i] = next;
-        next = tmp;
+        std::swap(blks[i], next);
         ++i;
     } while (next != blk);
 }
@@ -158,10 +154,7 @@ CacheSet<Blktype>::moveToTail(Blktype *blk)
 
     do {
         assert(i >= 0);
-        // swap blks[i] and next
-        Blktype *tmp = blks[i];
-        blks[i] = next;
-        next = tmp;
+        std::swap(blks[i], next);
         --i;
     } while (next != blk);
 }