Ruby: Eliminate modulo op for computing set size.

This commit is contained in:
Nilay Vaish 2011-08-26 12:27:58 -05:00
parent ba265abbfd
commit a08cc94936

View file

@ -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) {