summaryrefslogtreecommitdiff
path: root/src/mem/ruby
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2011-08-26 12:27:58 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2011-08-26 12:27:58 -0500
commita08cc94936d4960f837731537b454a63657efd04 (patch)
treef3e6058bedd8128051c6a618809b1bb77eee22e2 /src/mem/ruby
parentba265abbfd70060cc61a3b4a53b4b1cfcb7a96fe (diff)
downloadgem5-a08cc94936d4960f837731537b454a63657efd04.tar.xz
Ruby: Eliminate modulo op for computing set size.
Diffstat (limited to 'src/mem/ruby')
-rw-r--r--src/mem/ruby/common/Set.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/mem/ruby/common/Set.cc b/src/mem/ruby/common/Set.cc
index ffc0a3f07..12d0b2a21 100644
--- a/src/mem/ruby/common/Set.cc
+++ b/src/mem/ruby/common/Set.cc
@@ -300,8 +300,7 @@ void
Set::setSize(int size)
{
m_nSize = size;
-
- m_nArrayLen = m_nSize / LONG_BITS + ((m_nSize % LONG_BITS == 0) ? 0 : 1 );
+ m_nArrayLen = (m_nSize + LONG_BITS - 1) / LONG_BITS;
// decide whether to use dynamic or static alloction
if (m_nArrayLen <= NUMBER_WORDS_PER_SET) {