Skip to content

Commit

Permalink
Promote the constant 1 to long long, 1LL or 1ULL in int64_t-sensitive…
Browse files Browse the repository at this point in the history
… context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168304 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chapuni committed Nov 19, 2012
1 parent 4a8654e commit 1fcbb8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions include/llvm/Object/RelocVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ class RelocVisitor {
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;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/VMCore/Attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@ bool AttrBuilder::hasAlignmentAttr() const {
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);
}

Expand Down

0 comments on commit 1fcbb8f

Please sign in to comment.