Use intptr_t instead of unsigned here, which is more appropriate
[oota-llvm.git] / include / llvm / ADT / PointerIntPair.h
index 773dea49c25bb0ccfd304aa9a1e415f6f09333d7..9d34b44a530e75cad1b550237a30034f7ccf4212 100644 (file)
@@ -42,30 +42,30 @@ public:
   }
   
   IntType getInt() const {
-    return (IntType)(Value & (1 << IntBits)-1);
+    return (IntType)(Value & ((1 << IntBits)-1));
   }
   
   void setPointer(PointerTy Ptr) {
     intptr_t PtrVal = reinterpret_cast<intptr_t>(Ptr);
-    assert((PtrVal & (1 << IntBits)-1) == 0 &&
+    assert((PtrVal & ((1 << IntBits)-1)) == 0 &&
            "Pointer is not sufficiently aligned");
     Value = PtrVal | (intptr_t)getInt();
   }
   
   void setInt(IntType Int) {
-    assert(Int < (1 << IntBits) && "Integer too large for field");
+    assert(intptr_t(Int) < (1 << IntBits) && "Integer too large for field");
     Value = reinterpret_cast<intptr_t>(getPointer()) | (intptr_t)Int;
   }
   
   void *getOpaqueValue() const { return reinterpret_cast<void*>(Value); }
   void setFromOpaqueValue(void *Val) { Value = reinterpret_cast<intptr_t>(Val);}
   
-  bool operator==(const PointerIntPair &RHS) const {
-    return Value == RHS.Value;
-  }
-  bool operator!=(const PointerIntPair &RHS) const {
-    return Value != RHS.Value;
-  }
+  bool operator==(const PointerIntPair &RHS) const {return Value == RHS.Value;}
+  bool operator!=(const PointerIntPair &RHS) const {return Value != RHS.Value;}
+  bool operator<(const PointerIntPair &RHS) const {return Value < RHS.Value;}
+  bool operator>(const PointerIntPair &RHS) const {return Value > RHS.Value;}
+  bool operator<=(const PointerIntPair &RHS) const {return Value <= RHS.Value;}
+  bool operator>=(const PointerIntPair &RHS) const {return Value >= RHS.Value;}
 };
 
 // Provide specialization of DenseMapInfo for PointerIntPair.