summaryrefslogtreecommitdiff
path: root/boost/multiprecision/tommath.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/multiprecision/tommath.hpp')
-rw-r--r--boost/multiprecision/tommath.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/boost/multiprecision/tommath.hpp b/boost/multiprecision/tommath.hpp
index 3d576051ae..38a112fe9f 100644
--- a/boost/multiprecision/tommath.hpp
+++ b/boost/multiprecision/tommath.hpp
@@ -12,6 +12,7 @@
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/cstdint.hpp>
#include <boost/scoped_array.hpp>
+#include <boost/functional/hash_fwd.hpp>
#include <tommath.h>
#include <cmath>
#include <limits>
@@ -651,6 +652,16 @@ inline typename enable_if<is_signed<Integer>, Integer>::type eval_integer_modulu
return eval_integer_modulus(x, boost::multiprecision::detail::unsigned_abs(val));
}
+inline std::size_t hash_value(const tommath_int& val)
+{
+ std::size_t result = 0;
+ std::size_t len = val.data().used;
+ for(std::size_t i = 0; i < len; ++i)
+ boost::hash_combine(result, val.data().dp[i]);
+ boost::hash_combine(result, val.data().sign);
+ return result;
+}
+
} // namespace backends
using boost::multiprecision::backends::tommath_int;