|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2007-12-16 06:06:17
Author: danieljames
Date: 2007-12-16 06:06:16 EST (Sun, 16 Dec 2007)
New Revision: 42101
URL: http://svn.boost.org/trac/boost/changeset/42101
Log:
Remove hard-coded length of prime numbers.
Text files modified:
sandbox/unordered/boost/unordered/detail/hash_table.hpp | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
Modified: sandbox/unordered/boost/unordered/detail/hash_table.hpp
==============================================================================
--- sandbox/unordered/boost/unordered/detail/hash_table.hpp (original)
+++ sandbox/unordered/boost/unordered/detail/hash_table.hpp 2007-12-16 06:06:16 EST (Sun, 16 Dec 2007)
@@ -82,17 +82,21 @@
// no throw
inline std::size_t next_prime(std::size_t n) {
+ std::size_t const* const prime_list_end = prime_list +
+ sizeof(prime_list) / sizeof(*prime_list);
std::size_t const* bound =
- std::lower_bound(prime_list,prime_list + 28, n);
- if(bound == prime_list + 28)
+ std::lower_bound(prime_list,prime_list_end, n);
+ if(bound == prime_list_end)
bound--;
return *bound;
}
// no throw
inline std::size_t prev_prime(std::size_t n) {
+ std::size_t const* const prime_list_end = prime_list +
+ sizeof(prime_list) / sizeof(*prime_list);
std::size_t const* bound =
- std::upper_bound(prime_list,prime_list + 28, n);
+ std::upper_bound(prime_list,prime_list_end, n);
if(bound != prime_list)
bound--;
return *bound;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk