From a08cc94936d4960f837731537b454a63657efd04 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Fri, 26 Aug 2011 12:27:58 -0500 Subject: Ruby: Eliminate modulo op for computing set size. --- src/mem/ruby/common/Set.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/mem/ruby/common/Set.cc') 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) { -- cgit v1.2.3