From: Nilay Vaish Date: Fri, 26 Aug 2011 17:27:58 +0000 (-0500) Subject: Ruby: Eliminate modulo op for computing set size. X-Git-Tag: stable_2012_02_02~106 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a08cc94936d4960f837731537b454a63657efd04;p=gem5.git Ruby: Eliminate modulo op for computing set size. --- 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) {