[llvm-commits] [llvm] r81111 - /llvm/trunk/include/llvm/ADT/DenseMapInfo.h

Duncan Sands baldrick at free.fr
Sun Sep 6 04:45:14 PDT 2009


Author: baldrick
Date: Sun Sep  6 06:45:14 2009
New Revision: 81111

URL: http://llvm.org/viewvc/llvm-project?rev=81111&view=rev
Log:
Mark constants as unsigned, as pointed out by icc
warnings (#174).  Patch by Erick Tryzelaar.

Modified:
    llvm/trunk/include/llvm/ADT/DenseMapInfo.h

Modified: llvm/trunk/include/llvm/ADT/DenseMapInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMapInfo.h?rev=81111&r1=81110&r2=81111&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMapInfo.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMapInfo.h Sun Sep  6 06:45:14 2009
@@ -63,38 +63,38 @@
 // Provide DenseMapInfo for unsigned ints.
 template<> struct DenseMapInfo<unsigned> {
   static inline unsigned getEmptyKey() { return ~0; }
-  static inline unsigned getTombstoneKey() { return ~0 - 1; }
+  static inline unsigned getTombstoneKey() { return ~0U - 1; }
   static unsigned getHashValue(const unsigned& Val) { return Val * 37; }
   static bool isPod() { return true; }
   static bool isEqual(const unsigned& LHS, const unsigned& RHS) {
-  return LHS == RHS;
+    return LHS == RHS;
   }
 };
 
 // Provide DenseMapInfo for unsigned longs.
 template<> struct DenseMapInfo<unsigned long> {
-  static inline unsigned long getEmptyKey() { return ~0L; }
-  static inline unsigned long getTombstoneKey() { return ~0L - 1L; }
+  static inline unsigned long getEmptyKey() { return ~0UL; }
+  static inline unsigned long getTombstoneKey() { return ~0UL - 1L; }
   static unsigned getHashValue(const unsigned long& Val) {
-    return (unsigned)(Val * 37L);
+    return Val * 37UL;
   }
   static bool isPod() { return true; }
   static bool isEqual(const unsigned long& LHS, const unsigned long& RHS) {
-  return LHS == RHS;
+    return LHS == RHS;
   }
 };
 
 // Provide DenseMapInfo for unsigned long longs.
 template<> struct DenseMapInfo<unsigned long long> {
-  static inline unsigned long long getEmptyKey() { return ~0LL; }
-  static inline unsigned long long getTombstoneKey() { return ~0LL - 1LL; }
+  static inline unsigned long long getEmptyKey() { return ~0ULL; }
+  static inline unsigned long long getTombstoneKey() { return ~0ULL - 1ULL; }
   static unsigned getHashValue(const unsigned long long& Val) {
-    return (unsigned)(Val * 37LL);
+    return Val * 37ULL;
   }
   static bool isPod() { return true; }
   static bool isEqual(const unsigned long long& LHS,
                       const unsigned long long& RHS) {
-  return LHS == RHS;
+    return LHS == RHS;
   }
 };
 





More information about the llvm-commits mailing list