[llvm-commits] [llvm] r168304 - in /llvm/trunk: include/llvm/Object/RelocVisitor.h lib/VMCore/Attributes.cpp

NAKAMURA Takumi geek4civic at gmail.com
Mon Nov 19 02:03:09 PST 2012


Author: chapuni
Date: Mon Nov 19 04:03:09 2012
New Revision: 168304

URL: http://llvm.org/viewvc/llvm-project?rev=168304&view=rev
Log:
Promote the constant 1 to long long, 1LL or 1ULL in int64_t-sensitive context.

Modified:
    llvm/trunk/include/llvm/Object/RelocVisitor.h
    llvm/trunk/lib/VMCore/Attributes.cpp

Modified: llvm/trunk/include/llvm/Object/RelocVisitor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/RelocVisitor.h?rev=168304&r1=168303&r2=168304&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/RelocVisitor.h (original)
+++ llvm/trunk/include/llvm/Object/RelocVisitor.h Mon Nov 19 04:03:09 2012
@@ -80,17 +80,17 @@
   RelocToApply zeroExtend(RelocToApply r, char Width) {
     if (Width == r.Width)
       return r;
-    r.Value &= (1 << ((Width * 8))) - 1;
+    r.Value &= (1LL << ((Width * 8))) - 1;
     return r;
   }
   RelocToApply signExtend(RelocToApply r, char Width) {
     if (Width == r.Width)
       return r;
-    bool SignBit = r.Value & (1 << ((Width * 8) - 1));
+    bool SignBit = r.Value & (1LL << ((Width * 8) - 1));
     if (SignBit) {
-      r.Value |= ~((1 << (Width * 8)) - 1);
+      r.Value |= ~((1LL << (Width * 8)) - 1);
     } else {
-      r.Value &= (1 << (Width * 8)) - 1;
+      r.Value &= (1LL << (Width * 8)) - 1;
     }
     return r;
   }

Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=168304&r1=168303&r2=168304&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Mon Nov 19 04:03:09 2012
@@ -281,14 +281,14 @@
 uint64_t AttrBuilder::getAlignment() const {
   if (!hasAlignmentAttr())
     return 0;
-  return 1U <<
+  return 1ULL <<
     (((Bits & AttributesImpl::getAttrMask(Attributes::Alignment)) >> 16) - 1);
 }
 
 uint64_t AttrBuilder::getStackAlignment() const {
   if (!hasAlignmentAttr())
     return 0;
-  return 1U <<
+  return 1ULL <<
     (((Bits & AttributesImpl::getAttrMask(Attributes::StackAlignment))>>26)-1);
 }
 





More information about the llvm-commits mailing list