[PATCH] D11890: Fixed Visual Studio warnings.

James Touton via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 5 17:06:57 PDT 2015


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

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


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,15 @@
 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.34116.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150906/8fa31929/attachment.bin>


More information about the llvm-commits mailing list