diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2011-08-26 12:27:58 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2011-08-26 12:27:58 -0500 |
commit | a08cc94936d4960f837731537b454a63657efd04 (patch) | |
tree | f3e6058bedd8128051c6a618809b1bb77eee22e2 | |
parent | ba265abbfd70060cc61a3b4a53b4b1cfcb7a96fe (diff) | |
download | gem5-a08cc94936d4960f837731537b454a63657efd04.tar.xz |
Ruby: Eliminate modulo op for computing set size.
-rw-r--r-- | src/mem/ruby/common/Set.cc | 3 |
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) { |