[llvm-commits] [llvm] r152004 - in /llvm/trunk: include/llvm/ADT/APFloat.h include/llvm/ADT/APInt.h lib/Support/APFloat.cpp lib/Support/APInt.cpp lib/VMCore/LLVMContextImpl.h

Duncan Sands baldrick at free.fr
Sun Mar 4 05:49:26 PST 2012


Hi Chandler,

> --- llvm/trunk/include/llvm/ADT/APFloat.h (original)
> +++ llvm/trunk/include/llvm/ADT/APFloat.h Sun Mar  4 06:02:57 2012
> @@ -328,8 +328,16 @@
>
>       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

frought -> fraught

> --- llvm/trunk/lib/Support/APInt.cpp (original)
> +++ llvm/trunk/lib/Support/APInt.cpp Sun Mar  4 06:02:57 2012
...
> +hash_code llvm::hash_value(const APInt&Arg) {
> +  if (Arg.isSingleWord())
> +    return hash_combine(Arg.VAL);
>
...
> +  return hash_combine_range(Arg.pVal, Arg.pVal + Arg.getNumWords());
>   }

Is distinguishing between these two cases (rather than just always doing
the second case) actually a win?

Ciao, Duncan.



More information about the llvm-commits mailing list