aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT/APFloat.h
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-03-04 12:02:57 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-03-04 12:02:57 +0000
commited7692a136a9bcf513b91b7b5eb33a1e2d83e7ee (patch)
tree699f358d3fdc8138b9aa7cadf8427eb2473c739e /include/llvm/ADT/APFloat.h
parent528f0bbe19553dfadedca040df13a389daa7593d (diff)
downloadexternal_llvm-ed7692a136a9bcf513b91b7b5eb33a1e2d83e7ee.zip
external_llvm-ed7692a136a9bcf513b91b7b5eb33a1e2d83e7ee.tar.gz
external_llvm-ed7692a136a9bcf513b91b7b5eb33a1e2d83e7ee.tar.bz2
Replace the hashing functions on APInt and APFloat with overloads of the
new hash_value infrastructure, and replace their implementations using hash_combine. This removes a complete copy of Jenkin's lookup3 hash function (which is both significantly slower and lower quality than the one implemented in hash_combine) along with a somewhat scary xor-only hash function. Now that APInt and APFloat can be passed directly to hash_combine, simplify the rest of the LLVMContextImpl hashing to use the new infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/APFloat.h')
-rw-r--r--include/llvm/ADT/APFloat.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/llvm/ADT/APFloat.h b/include/llvm/ADT/APFloat.h
index d2566a4..d40727d 100644
--- a/include/llvm/ADT/APFloat.h
+++ b/include/llvm/ADT/APFloat.h
@@ -328,8 +328,16 @@ namespace llvm {
APFloat& operator=(const APFloat &);
- /* Return an arbitrary integer value usable for hashing. */
- uint32_t getHashValue() const;
+ /// \brief Overload to compute a hash code for an APFloat value.
+ ///
+ /// Note that the use of hash codes for floating point values is in general
+ /// frought with peril. Equality is hard to define for these values. For
+ /// example, should negative and positive zero hash to different codes? Are
+ /// they equal or not? This hash value implementation specifically
+ /// emphasizes producing different codes for different inputs in order to
+ /// be used in canonicalization and memoization. As such, equality is
+ /// bitwiseIsEqual, and 0 != -0.
+ friend hash_code hash_value(const APFloat &Arg);
/// Converts this value into a decimal string.
///