|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2007-10-13 18:29:52
Author: danieljames
Date: 2007-10-13 18:29:52 EDT (Sat, 13 Oct 2007)
New Revision: 39992
URL: http://svn.boost.org/trac/boost/changeset/39992
Log:
Merge just the hash library from trunk - as a full merge failed.
Added:
branches/hash/libs/functional/hash/test/hash_float_test.hpp
- copied, changed from r39985, /trunk/libs/functional/hash/test/hash_float_test.hpp
branches/hash/libs/functional/hash/test/hash_long_double_test.cpp
- copied unchanged from r39985, /trunk/libs/functional/hash/test/hash_long_double_test.cpp
Properties modified:
branches/hash/libs/functional/hash/test/hash_complex_test.cpp (props changed)
Text files modified:
branches/hash/boost/functional/detail/hash_float.hpp | 12 +
branches/hash/boost/functional/hash/hash.hpp | 17 ++
branches/hash/libs/functional/hash/doc/hash.qbk | 4
branches/hash/libs/functional/hash/doc/links.qbk | 18 +-
branches/hash/libs/functional/hash/doc/ref.xml | 5
branches/hash/libs/functional/hash/test/Jamfile.v2 | 1
branches/hash/libs/functional/hash/test/hash_float_test.cpp | 222 ---------------------------------------
branches/hash/libs/functional/hash/test/hash_float_test.hpp | 89 ++++++++-------
8 files changed, 84 insertions(+), 284 deletions(-)
Modified: branches/hash/boost/functional/detail/hash_float.hpp
==============================================================================
--- branches/hash/boost/functional/detail/hash_float.hpp (original)
+++ branches/hash/boost/functional/detail/hash_float.hpp 2007-10-13 18:29:52 EDT (Sat, 13 Oct 2007)
@@ -20,10 +20,13 @@
#include <boost/limits.hpp>
#include <boost/assert.hpp>
-// Cygwin
+
+// Select implementation for the current platform.
+
+// Cygwn
#if defined(__CYGWIN__)
# if defined(__i386__) || defined(_M_IX86)
-# define BOOST_HASH_USE_X86
+# define BOOST_HASH_USE_x86_BINARY_HASH
# endif
// STLport
@@ -87,8 +90,9 @@
seed ^= value + (seed<<6) + (seed>>2);
}
-// A simple, utterly non-portable hash algorithm for x86.
-#if defined(BOOST_HASH_USE_X86)
+
+// A simple, non-portable hash algorithm for x86.
+#if defined(BOOST_HASH_USE_x86_BINARY_HASH)
inline std::size_t float_hash_impl(float v)
{
boost::uint32_t* ptr = (boost::uint32_t*)&v;
Modified: branches/hash/boost/functional/hash/hash.hpp
==============================================================================
--- branches/hash/boost/functional/hash/hash.hpp (original)
+++ branches/hash/boost/functional/hash/hash.hpp 2007-10-13 18:29:52 EDT (Sat, 13 Oct 2007)
@@ -219,6 +219,7 @@
{
std::size_t x = static_cast<std::size_t>(
reinterpret_cast<std::ptrdiff_t>(v));
+
return x + (x >> 3);
}
@@ -472,10 +473,14 @@
struct hash<T*>
: public std::unary_function<T*, std::size_t>
{
- std::size_t operator()(T* v) const \
- { \
- return boost::hash_value(v); \
- } \
+ std::size_t operator()(T* v) const
+ {
+#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
+ return boost::hash_value(v);
+#else
+ return boost::hash_value<T*>(v);
+#endif
+ }
};
#else
namespace hash_detail
@@ -492,7 +497,11 @@
{
std::size_t operator()(T val) const
{
+#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590)
return boost::hash_value(val);
+#else
+ return boost::hash_value<T>(val);
+#endif
}
};
};
Modified: branches/hash/libs/functional/hash/doc/hash.qbk
==============================================================================
--- branches/hash/libs/functional/hash/doc/hash.qbk (original)
+++ branches/hash/libs/functional/hash/doc/hash.qbk 2007-10-13 18:29:52 EDT (Sat, 13 Oct 2007)
@@ -1,7 +1,7 @@
[library Boost.Functional/Hash
- [quickbook 1.3]
+ [quickbook 1.4]
[authors [James, Daniel]]
- [copyright 2005 2007 Daniel James]
+ [copyright 2005 2006 2007 Daniel James]
[purpose A TR1 hash function object that can be extended to hash user
defined types]
[category higher-order]
Modified: branches/hash/libs/functional/hash/doc/links.qbk
==============================================================================
--- branches/hash/libs/functional/hash/doc/links.qbk (original)
+++ branches/hash/libs/functional/hash/doc/links.qbk 2007-10-13 18:29:52 EDT (Sat, 13 Oct 2007)
@@ -5,22 +5,22 @@
[section:links Links]
-[*A Proposal to Add Hash Tables to the Standard Library]\n
-[@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1456.html]\n
+[*A Proposal to Add Hash Tables to the Standard Library]
+[@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1456.html]
The hash table proposal explains much of the design. The hash function object
is discussed in Section D.
-[*The C++ Standard Library Technical Report.]\n
-[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf]\n
+[*The C++ Standard Library Technical Report.]
+[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf]
Contains the hash function specification in section 6.3.2.
-[*Library Extension Technical Report Issues List.]\n
-[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf]\n
+[*Library Extension Technical Report Issues List.]
+[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf]
The library implements the extension described in Issue 6.18, pages 63-67.
-[*Methods for Identifying Versioned and Plagiarised Documents]\n
-Timothy C. Hoad, Justin Zobel\n
-[@http://www.cs.rmit.edu.au/~jz/fulltext/jasist-tch.pdf]\n
+[*Methods for Identifying Versioned and Plagiarised Documents]
+Timothy C. Hoad, Justin Zobel
+[@http://www.cs.rmit.edu.au/~jz/fulltext/jasist-tch.pdf]
Contains the hash function that [funcref boost::hash_combine] is based on.
[endsect]
Modified: branches/hash/libs/functional/hash/doc/ref.xml
==============================================================================
--- branches/hash/libs/functional/hash/doc/ref.xml (original)
+++ branches/hash/libs/functional/hash/doc/ref.xml 2007-10-13 18:29:52 EDT (Sat, 13 Oct 2007)
@@ -794,16 +794,15 @@
</row>
<row>
<entry>
- <code>std::complex<val[N]></code>
+ <code>std::complex<T></code>
</entry>
- <entry>For built in types when <code>val.imag() == 0</code>, <code>hash_value(val.real())</code></entry>
+ <entry>When <code>T</code> is a built in type and <code>val.imag() == 0</code>, the result is equal to <code>hash_value(val.real())</code>. Otherwise an unspecified value, except that equal arguments shall yield the same result.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</returns>
</overloaded-function>
-
</free-function-group>
</namespace>
</header>
Modified: branches/hash/libs/functional/hash/test/Jamfile.v2
==============================================================================
--- branches/hash/libs/functional/hash/test/Jamfile.v2 (original)
+++ branches/hash/libs/functional/hash/test/Jamfile.v2 2007-10-13 18:29:52 EDT (Sat, 13 Oct 2007)
@@ -20,6 +20,7 @@
[ run hash_pointer_test.cpp ]
[ run hash_function_pointer_test.cpp ]
[ run hash_float_test.cpp : : : <test-info>always_show_run_output ]
+ [ run hash_long_double_test.cpp : : : <test-info>always_show_run_output ]
[ run hash_string_test.cpp ]
[ run hash_range_test.cpp ]
[ run hash_custom_test.cpp ]
Modified: branches/hash/libs/functional/hash/test/hash_float_test.cpp
==============================================================================
--- branches/hash/libs/functional/hash/test/hash_float_test.cpp (original)
+++ branches/hash/libs/functional/hash/test/hash_float_test.cpp 2007-10-13 18:29:52 EDT (Sat, 13 Oct 2007)
@@ -3,234 +3,16 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#include "./config.hpp"
+#include "hash_float_test.hpp"
-#ifdef TEST_STD_INCLUDES
-# include <functional>
-#else
-# include <boost/functional/hash.hpp>
-#endif
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <cmath>
-#include <boost/limits.hpp>
-
-#include <iostream>
-
-#if defined(BOOST_MSVC)
-#pragma warning(push)
-#pragma warning(disable:4127) // conditional expression is constant
-#endif
-
-template <class T>
-void float_tests(char const* name, T* = 0)
-{
- std::cerr<<"\n"
- <<"Testing " BOOST_STRINGIZE(HASH_NAMESPACE) "::hash<"<<name<<">\n"
- <<"\n"
- <<"boost::hash_detail::limits<T>::digits = "
- <<boost::hash_detail::limits<T>::digits<<"\n"
- <<"boost::hash_detail::limits<int>::digits = "
- <<boost::hash_detail::limits<int>::digits<<"\n"
- <<"boost::hash_detail::limits<std::size_t>::digits = "
- <<boost::hash_detail::limits<std::size_t>::digits<<"\n"
- <<"\n"
- ;
-
- HASH_NAMESPACE::hash<T> x1;
-
- T zero = 0;
- T minus_zero = (T) -1 * zero;
-
- BOOST_TEST(zero == minus_zero);
- BOOST_TEST(x1(zero) == x1(minus_zero));
-
- BOOST_TEST(x1(zero) == HASH_NAMESPACE::hash_value(zero));
- BOOST_TEST(x1(minus_zero) == HASH_NAMESPACE::hash_value(minus_zero));
-
- using namespace std;
-
-// Doing anything with infinity causes borland to crash.
-#if defined(__BORLANDC__)
- std::cerr<<"Not running infinity checks on Borland, as it causes it to crash.\n";
-#else
- if(boost::hash_detail::limits<T>::has_infinity) {
- T infinity = -log(zero);
- T infinity2 = (T) 1. / zero;
- T infinity3 = (T) -1. / minus_zero;
- T infinity4 = boost::hash_detail::limits<T>::infinity();
-
- T minus_infinity = log(zero);
- T minus_infinity2 = (T) -1. / zero;
- T minus_infinity3 = (T) 1. / minus_zero;
-
- BOOST_TEST(x1(infinity) == HASH_NAMESPACE::hash_value(infinity));
- BOOST_TEST(x1(minus_infinity)
- == HASH_NAMESPACE::hash_value(minus_infinity));
-
- if(infinity == infinity2)
- BOOST_TEST(x1(infinity) == x1(infinity2));
- if(infinity == infinity3)
- BOOST_TEST(x1(infinity) == x1(infinity3));
- if(infinity == infinity4)
- BOOST_TEST(x1(infinity) == x1(infinity4));
-
- if(minus_infinity == minus_infinity2)
- BOOST_TEST(x1(minus_infinity) == x1(minus_infinity2));
- if(minus_infinity == minus_infinity3)
- BOOST_TEST(x1(minus_infinity) == x1(minus_infinity3));
-
- BOOST_TEST(infinity != minus_infinity);
-
- if(x1(infinity) == x1(minus_infinity)) {
- std::cerr<<"x1(infinity) == x1(-infinity) == "<<x1(infinity)<<"\n";
- }
-
- // This should really be 'has_denorm == denorm_present' but some
- // compilers don't have 'denorm_present'. See also a later use.
- if(boost::hash_detail::limits<T>::has_denorm) {
- if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(infinity)) {
- std::cerr<<"x1(denorm_min) == x1(infinity) == "<<x1(infinity)<<"\n";
- }
- if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(minus_infinity)) {
- std::cerr<<"x1(denorm_min) == x1(-infinity) == "<<x1(minus_infinity)<<"\n";
- }
- }
- if(boost::hash_detail::limits<T>::has_quiet_NaN) {
- if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(infinity)) {
- std::cerr<<"x1(quiet_NaN) == x1(infinity) == "<<x1(infinity)<<"\n";
- }
- if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(minus_infinity)) {
- std::cerr<<"x1(quiet_NaN) == x1(-infinity) == "<<x1(minus_infinity)<<"\n";
- }
- }
- }
-#endif
-
- T max = (boost::hash_detail::limits<T>::max)();
- T half_max = max / 2;
- T quarter_max = max / 4;
- T three_quarter_max = max - quarter_max;
-
- BOOST_TEST(x1(max) == HASH_NAMESPACE::hash_value(max));
- BOOST_TEST(x1(half_max) == HASH_NAMESPACE::hash_value(half_max));
- BOOST_TEST(x1(quarter_max) == HASH_NAMESPACE::hash_value(quarter_max));
- BOOST_TEST(x1(three_quarter_max) == HASH_NAMESPACE::hash_value(three_quarter_max));
-
- // The '!=' tests could legitimately fail, but with my hash it indicates a bug.
- BOOST_TEST(x1(max) == x1(max));
- BOOST_TEST(x1(max) != x1(quarter_max));
- BOOST_TEST(x1(max) != x1(half_max));
- BOOST_TEST(x1(max) != x1(three_quarter_max));
- BOOST_TEST(x1(quarter_max) == x1(quarter_max));
- BOOST_TEST(x1(quarter_max) != x1(half_max));
- BOOST_TEST(x1(quarter_max) != x1(three_quarter_max));
- BOOST_TEST(x1(half_max) == x1(half_max));
- BOOST_TEST(x1(half_max) != x1(three_quarter_max));
- BOOST_TEST(x1(three_quarter_max) == x1(three_quarter_max));
-
-// Intel with gcc stdlib sometimes segfaults on calls to asin and acos.
-#if !((defined(__INTEL_COMPILER) || defined(__ICL) || \
- defined(__ICC) || defined(__ECC)) && \
- (defined(__GLIBCPP__) || defined(__GLIBCXX__)))
- T v1 = asin((T) 1);
- T v2 = acos((T) 0);
- if(v1 == v2)
- BOOST_TEST(x1(v1) == x1(v2));
- BOOST_TEST(x1(v1) == HASH_NAMESPACE::hash_value(v1));
- BOOST_TEST(x1(v2) == HASH_NAMESPACE::hash_value(v2));
-#endif
-
- BOOST_TEST(x1(boost::hash_detail::limits<T>::epsilon()) ==
- HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::epsilon()));
-
- BOOST_TEST(boost::hash_detail::limits<T>::epsilon() != (T) 0);
- if(x1(boost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
- std::cerr<<"x1(epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
-
- BOOST_TEST(-boost::hash_detail::limits<T>::epsilon() != (T) 0);
- if(x1(-boost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
- std::cerr<<"x1(-epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
-
- BOOST_TEST((T) 1 + boost::hash_detail::limits<T>::epsilon() != (T) 1);
- if(x1((T) 1 + boost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
- std::cerr<<"x1(1 + epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
-
- BOOST_TEST((T) 1 - boost::hash_detail::limits<T>::epsilon() != (T) 1);
- if(x1((T) 1 - boost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
- std::cerr<<"x1(1 - epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
-
- BOOST_TEST((T) -1 + boost::hash_detail::limits<T>::epsilon() != (T) -1);
- if(x1((T) -1 + boost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
- std::cerr<<"x1(-1 + epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
-
- BOOST_TEST((T) -1 - boost::hash_detail::limits<T>::epsilon() != (T) -1);
- if(x1((T) -1 - boost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
- std::cerr<<"x1(-1 - epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
-
- // As before.
- if(boost::hash_detail::limits<T>::has_denorm) {
- if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(zero)) {
- std::cerr<<"x1(denorm_min) == x1(zero) == "<<x1(zero)<<"\n";
- }
-#if !BOOST_WORKAROUND(__DECCXX_VER,<70190006)
- // The Tru64/CXX standard library prior to 7.1 contains a bug in the
- // specialization of boost::hash_detail::limits::denorm_min() for long
- // doubles which causes this test to fail.
- if(x1(boost::hash_detail::limits<T>::denorm_min()) !=
- HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::denorm_min()))
- {
- std::cerr<<"x1(boost::hash_detail::limits<T>::denorm_min()) = "
- << x1(boost::hash_detail::limits<T>::denorm_min())
- << "\nhash_value(boost::hash_detail::limits<T>::denorm_min()) = "
- << HASH_NAMESPACE::hash_value(
- boost::hash_detail::limits<T>::denorm_min())
- << "\nx1(0) = "<<x1(0)<<"\n";
- }
-#endif
- }
-
-// NaN also causes borland to crash.
-#if !defined(__BORLANDC__)
- if(boost::hash_detail::limits<T>::has_quiet_NaN) {
- if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(1.0)) {
- std::cerr<<"x1(quiet_NaN) == x1(1.0) == "<<x1(1.0)<<"\n";
- }
- BOOST_TEST(x1(boost::hash_detail::limits<T>::quiet_NaN()) ==
- HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::quiet_NaN()));
- }
-#endif
-}
-
-void hash_float_tests()
+int main()
{
std::cerr<<"Compiler: "<<BOOST_COMPILER<<"\n";
std::cerr<<"Platform: "<<BOOST_PLATFORM<<"\n";
std::cerr<<"Library: "<<BOOST_STDLIB<<"\n\n";
float_tests("float", (float*) 0);
-}
-
-void hash_double_tests()
-{
float_tests("double", (double*) 0);
-}
-
-void hash_long_double_tests()
-{
- float_tests("long double", (long double*) 0);
-}
-
-int main()
-{
- hash_float_tests();
- hash_double_tests();
- hash_long_double_tests();
return boost::report_errors();
}
-
-#if defined(BOOST_MSVC)
-#pragma warning(pop)
-#endif
Copied: branches/hash/libs/functional/hash/test/hash_float_test.hpp (from r39985, /trunk/libs/functional/hash/test/hash_float_test.hpp)
==============================================================================
--- /trunk/libs/functional/hash/test/hash_float_test.hpp (original)
+++ branches/hash/libs/functional/hash/test/hash_float_test.hpp 2007-10-13 18:29:52 EDT (Sat, 13 Oct 2007)
@@ -18,18 +18,23 @@
#include <iostream>
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4127) // conditional expression is constant
+#endif
+
template <class T>
void float_tests(char const* name, T* = 0)
{
std::cerr<<"\n"
<<"Testing " BOOST_STRINGIZE(HASH_NAMESPACE) "::hash<"<<name<<">\n"
<<"\n"
- <<"std::numeric_limits<T>::digits = "
- <<std::numeric_limits<T>::digits<<"\n"
- <<"std::numeric_limits<int>::digits = "
- <<std::numeric_limits<int>::digits<<"\n"
- <<"std::numeric_limits<std::size_t>::digits = "
- <<std::numeric_limits<std::size_t>::digits<<"\n"
+ <<"boost::hash_detail::limits<T>::digits = "
+ <<boost::hash_detail::limits<T>::digits<<"\n"
+ <<"boost::hash_detail::limits<int>::digits = "
+ <<boost::hash_detail::limits<int>::digits<<"\n"
+ <<"boost::hash_detail::limits<std::size_t>::digits = "
+ <<boost::hash_detail::limits<std::size_t>::digits<<"\n"
<<"\n"
;
@@ -50,11 +55,11 @@
#if defined(__BORLANDC__)
std::cerr<<"Not running infinity checks on Borland, as it causes it to crash.\n";
#else
- if(std::numeric_limits<T>::has_infinity) {
+ if(boost::hash_detail::limits<T>::has_infinity) {
T infinity = -log(zero);
T infinity2 = (T) 1. / zero;
T infinity3 = (T) -1. / minus_zero;
- T infinity4 = std::numeric_limits<T>::infinity();
+ T infinity4 = boost::hash_detail::limits<T>::infinity();
T minus_infinity = log(zero);
T minus_infinity2 = (T) -1. / zero;
@@ -84,26 +89,26 @@
// This should really be 'has_denorm == denorm_present' but some
// compilers don't have 'denorm_present'. See also a later use.
- if(std::numeric_limits<T>::has_denorm) {
- if(x1(std::numeric_limits<T>::denorm_min()) == x1(infinity)) {
+ if(boost::hash_detail::limits<T>::has_denorm) {
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(infinity)) {
std::cerr<<"x1(denorm_min) == x1(infinity) == "<<x1(infinity)<<"\n";
}
- if(x1(std::numeric_limits<T>::denorm_min()) == x1(minus_infinity)) {
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(minus_infinity)) {
std::cerr<<"x1(denorm_min) == x1(-infinity) == "<<x1(minus_infinity)<<"\n";
}
}
- if(std::numeric_limits<T>::has_quiet_NaN) {
- if(x1(std::numeric_limits<T>::quiet_NaN()) == x1(infinity)) {
+ if(boost::hash_detail::limits<T>::has_quiet_NaN) {
+ if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(infinity)) {
std::cerr<<"x1(quiet_NaN) == x1(infinity) == "<<x1(infinity)<<"\n";
}
- if(x1(std::numeric_limits<T>::quiet_NaN()) == x1(minus_infinity)) {
+ if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(minus_infinity)) {
std::cerr<<"x1(quiet_NaN) == x1(-infinity) == "<<x1(minus_infinity)<<"\n";
}
}
}
#endif
- T max = (std::numeric_limits<T>::max)();
+ T max = (boost::hash_detail::limits<T>::max)();
T half_max = max / 2;
T quarter_max = max / 4;
T three_quarter_max = max - quarter_max;
@@ -137,50 +142,50 @@
BOOST_TEST(x1(v2) == HASH_NAMESPACE::hash_value(v2));
#endif
- BOOST_TEST(x1(std::numeric_limits<T>::epsilon()) ==
- HASH_NAMESPACE::hash_value(std::numeric_limits<T>::epsilon()));
+ BOOST_TEST(x1(boost::hash_detail::limits<T>::epsilon()) ==
+ HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::epsilon()));
- BOOST_TEST(std::numeric_limits<T>::epsilon() != (T) 0);
- if(x1(std::numeric_limits<T>::epsilon()) == x1((T) 0))
+ BOOST_TEST(boost::hash_detail::limits<T>::epsilon() != (T) 0);
+ if(x1(boost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
std::cerr<<"x1(epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
- BOOST_TEST(-std::numeric_limits<T>::epsilon() != (T) 0);
- if(x1(-std::numeric_limits<T>::epsilon()) == x1((T) 0))
+ BOOST_TEST(-boost::hash_detail::limits<T>::epsilon() != (T) 0);
+ if(x1(-boost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
std::cerr<<"x1(-epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
- BOOST_TEST((T) 1 + std::numeric_limits<T>::epsilon() != (T) 1);
- if(x1((T) 1 + std::numeric_limits<T>::epsilon()) == x1((T) 1))
+ BOOST_TEST((T) 1 + boost::hash_detail::limits<T>::epsilon() != (T) 1);
+ if(x1((T) 1 + boost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
std::cerr<<"x1(1 + epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
- BOOST_TEST((T) 1 - std::numeric_limits<T>::epsilon() != (T) 1);
- if(x1((T) 1 - std::numeric_limits<T>::epsilon()) == x1((T) 1))
+ BOOST_TEST((T) 1 - boost::hash_detail::limits<T>::epsilon() != (T) 1);
+ if(x1((T) 1 - boost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
std::cerr<<"x1(1 - epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
- BOOST_TEST((T) -1 + std::numeric_limits<T>::epsilon() != (T) -1);
- if(x1((T) -1 + std::numeric_limits<T>::epsilon()) == x1((T) -1))
+ BOOST_TEST((T) -1 + boost::hash_detail::limits<T>::epsilon() != (T) -1);
+ if(x1((T) -1 + boost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
std::cerr<<"x1(-1 + epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
- BOOST_TEST((T) -1 - std::numeric_limits<T>::epsilon() != (T) -1);
- if(x1((T) -1 - std::numeric_limits<T>::epsilon()) == x1((T) -1))
+ BOOST_TEST((T) -1 - boost::hash_detail::limits<T>::epsilon() != (T) -1);
+ if(x1((T) -1 - boost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
std::cerr<<"x1(-1 - epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
// As before.
- if(std::numeric_limits<T>::has_denorm) {
- if(x1(std::numeric_limits<T>::denorm_min()) == x1(zero)) {
+ if(boost::hash_detail::limits<T>::has_denorm) {
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(zero)) {
std::cerr<<"x1(denorm_min) == x1(zero) == "<<x1(zero)<<"\n";
}
#if !BOOST_WORKAROUND(__DECCXX_VER,<70190006)
// The Tru64/CXX standard library prior to 7.1 contains a bug in the
- // specialization of std::numeric_limits::denorm_min() for long
+ // specialization of boost::hash_detail::limits::denorm_min() for long
// doubles which causes this test to fail.
- if(x1(std::numeric_limits<T>::denorm_min()) !=
- HASH_NAMESPACE::hash_value(std::numeric_limits<T>::denorm_min()))
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) !=
+ HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::denorm_min()))
{
- std::cerr<<"x1(std::numeric_limits<T>::denorm_min()) = "
- << x1(std::numeric_limits<T>::denorm_min())
- << "\nhash_value(std::numeric_limits<T>::denorm_min()) = "
+ std::cerr<<"x1(boost::hash_detail::limits<T>::denorm_min()) = "
+ << x1(boost::hash_detail::limits<T>::denorm_min())
+ << "\nhash_value(boost::hash_detail::limits<T>::denorm_min()) = "
<< HASH_NAMESPACE::hash_value(
- std::numeric_limits<T>::denorm_min())
+ boost::hash_detail::limits<T>::denorm_min())
<< "\nx1(0) = "<<x1(0)<<"\n";
}
#endif
@@ -188,12 +193,12 @@
// NaN also causes borland to crash.
#if !defined(__BORLANDC__)
- if(std::numeric_limits<T>::has_quiet_NaN) {
- if(x1(std::numeric_limits<T>::quiet_NaN()) == x1(1.0)) {
+ if(boost::hash_detail::limits<T>::has_quiet_NaN) {
+ if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(1.0)) {
std::cerr<<"x1(quiet_NaN) == x1(1.0) == "<<x1(1.0)<<"\n";
}
- BOOST_TEST(x1(std::numeric_limits<T>::quiet_NaN()) ==
- HASH_NAMESPACE::hash_value(std::numeric_limits<T>::quiet_NaN()));
+ BOOST_TEST(x1(boost::hash_detail::limits<T>::quiet_NaN()) ==
+ HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::quiet_NaN()));
}
#endif
}
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