diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2011-06-14 19:51:44 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2011-06-14 19:51:44 -0500 |
commit | 8bf92329eeea76e4e01c49f31e68c29cdada5985 (patch) | |
tree | afc0e1b57893a14095adb44c86ed70d4b429e0ef | |
parent | 91622602c29f847d9844ec66a1db4ca3740901d3 (diff) | |
download | gem5-8bf92329eeea76e4e01c49f31e68c29cdada5985.tar.xz |
Ruby: Correct set LONG_BITS and INDEX_SHIFT in class Set.
The code for Set class was written under the assumption that
std::numeric_limits<long>::digits returns the number of bits used for
data type long, which was presumed to be either 32 or 64. But return value
is actually one less, that is, it is either 31 or 63. The value is now
being incremented by 1 so as to correctly set it.
-rw-r--r-- | src/mem/ruby/common/Set.hh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mem/ruby/common/Set.hh b/src/mem/ruby/common/Set.hh index 5481c2ec7..b76c3409d 100644 --- a/src/mem/ruby/common/Set.hh +++ b/src/mem/ruby/common/Set.hh @@ -54,7 +54,7 @@ class Set long *m_p_nArray; // an word array to hold the bits in the set long m_p_nArray_Static[NUMBER_WORDS_PER_SET]; - static const int LONG_BITS = std::numeric_limits<long>::digits; + static const int LONG_BITS = std::numeric_limits<long>::digits + 1; static const int INDEX_SHIFT = LONG_BITS == 64 ? 6 : 5; static const int INDEX_MASK = (1 << INDEX_SHIFT) - 1; |