Ruby: Eliminate modulo op for computing set size.
This commit is contained in:
parent
ba265abbfd
commit
a08cc94936
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue