summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/backward/hashtable.h
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-08 03:20:30 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-08 03:20:30 +0000
commit643df0593c630691fa6877cddeefdd4c3023d444 (patch)
tree1eb48ad31d05a9ce117bedc17115de96dffa2f0b /libstdc++-v3/include/backward/hashtable.h
parent54f3f029d816c6d1626310649adfda740e203f7b (diff)
parentd5d8f1ccc6d3972dc5cfc0949e85e0b1c9e24ee0 (diff)
downloadgcc-643df0593c630691fa6877cddeefdd4c3023d444.tar.gz
* Merge from mainline rev 181122.transactional-memory
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/transactional-memory@181148 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/backward/hashtable.h')
-rw-r--r--libstdc++-v3/include/backward/hashtable.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/libstdc++-v3/include/backward/hashtable.h b/libstdc++-v3/include/backward/hashtable.h
index 91b0c602cec..dbba097d130 100644
--- a/libstdc++-v3/include/backward/hashtable.h
+++ b/libstdc++-v3/include/backward/hashtable.h
@@ -209,7 +209,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Note: assumes long is at least 32 bits.
enum { _S_num_primes = 29 };
- static const unsigned long __stl_prime_list[_S_num_primes] =
+ template<typename _PrimeType>
+ struct _Hashtable_prime_list
+ {
+ static const _PrimeType __stl_prime_list[_S_num_primes];
+
+ static const _PrimeType*
+ _S_get_prime_list();
+ };
+
+ template<typename _PrimeType> const _PrimeType
+ _Hashtable_prime_list<_PrimeType>::__stl_prime_list[_S_num_primes] =
{
5ul, 53ul, 97ul, 193ul, 389ul,
769ul, 1543ul, 3079ul, 6151ul, 12289ul,
@@ -219,11 +229,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
805306457ul, 1610612741ul, 3221225473ul, 4294967291ul
};
+ template<class _PrimeType> inline const _PrimeType*
+ _Hashtable_prime_list<_PrimeType>::_S_get_prime_list()
+ {
+ return __stl_prime_list;
+ }
+
inline unsigned long
__stl_next_prime(unsigned long __n)
{
- const unsigned long* __first = __stl_prime_list;
- const unsigned long* __last = __stl_prime_list + (int)_S_num_primes;
+ const unsigned long* __first = _Hashtable_prime_list<unsigned long>::_S_get_prime_list();
+ const unsigned long* __last = __first + (int)_S_num_primes;
const unsigned long* pos = std::lower_bound(__first, __last, __n);
return pos == __last ? *(__last - 1) : *pos;
}
@@ -417,7 +433,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
size_type
max_bucket_count() const
- { return __stl_prime_list[(int)_S_num_primes - 1]; }
+ { return _Hashtable_prime_list<unsigned long>::
+ _S_get_prime_list()[(int)_S_num_primes - 1];
+ }
size_type
elems_in_bucket(size_type __bucket) const