[PATCH] D11890: Fixed Visual Studio warnings.

James Touton via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 22:43:59 PDT 2015


jtouton updated this revision to Diff 34014.
jtouton added a comment.

- Fixed Visual Studio warning.
- Added assert in applyMask to verify that an appropriate value was passed for MaskWords.


http://reviews.llvm.org/D11890

Files:
  include/llvm/ADT/SmallBitVector.h

Index: include/llvm/ADT/SmallBitVector.h
===================================================================
--- include/llvm/ADT/SmallBitVector.h
+++ include/llvm/ADT/SmallBitVector.h
@@ -553,17 +553,14 @@
 private:
   template<bool AddBits, bool InvertMask>
   void applyMask(const uint32_t *Mask, unsigned MaskWords) {
-    if (NumBaseBits == 64 && MaskWords >= 2) {
-      uint64_t M = Mask[0] | (uint64_t(Mask[1]) << 32);
-      if (InvertMask) M = ~M;
-      if (AddBits) setSmallBits(getSmallBits() | M);
-      else         setSmallBits(getSmallBits() & ~M);
-    } else {
-      uint32_t M = Mask[0];
-      if (InvertMask) M = ~M;
-      if (AddBits) setSmallBits(getSmallBits() | M);
-      else         setSmallBits(getSmallBits() & ~M);
-    }
+    uintptr_t M = Mask[0];
+    if (MaskWords != 1) {
+	  assert((NumBaseBits == 64 && MaskWords == 2) && "Mask is larger than base!");
+      M |= uintptr_t(Mask[1]) << 32;
+	}
+    if (InvertMask) M = ~M;
+    if (AddBits) setSmallBits(getSmallBits() | M);
+    else         setSmallBits(getSmallBits() & ~M);
   }
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11890.34014.patch
Type: text/x-patch
Size: 1081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150904/d256f754/attachment.bin>


More information about the llvm-commits mailing list