Add newlines.

llvm-svn: 299493
This commit is contained in:
Rui Ueyama 2017-04-05 00:43:05 +00:00
parent a08fa2eca3
commit 5f20b6304b
1 changed files with 8 additions and 0 deletions

View File

@ -80,34 +80,42 @@ static ExprValue add(ExprValue A, ExprValue B) {
moveAbsRight(A, B); moveAbsRight(A, B);
return {A.Sec, A.ForceAbsolute, A.Val + B.getValue()}; return {A.Sec, A.ForceAbsolute, A.Val + B.getValue()};
} }
static ExprValue sub(ExprValue A, ExprValue B) { static ExprValue sub(ExprValue A, ExprValue B) {
return {A.Sec, A.Val - B.getValue()}; return {A.Sec, A.Val - B.getValue()};
} }
static ExprValue mul(ExprValue A, ExprValue B) { static ExprValue mul(ExprValue A, ExprValue B) {
return A.getValue() * B.getValue(); return A.getValue() * B.getValue();
} }
static ExprValue div(ExprValue A, ExprValue B) { static ExprValue div(ExprValue A, ExprValue B) {
if (uint64_t BV = B.getValue()) if (uint64_t BV = B.getValue())
return A.getValue() / BV; return A.getValue() / BV;
error("division by zero"); error("division by zero");
return 0; return 0;
} }
static ExprValue leftShift(ExprValue A, ExprValue B) { static ExprValue leftShift(ExprValue A, ExprValue B) {
return A.getValue() << B.getValue(); return A.getValue() << B.getValue();
} }
static ExprValue rightShift(ExprValue A, ExprValue B) { static ExprValue rightShift(ExprValue A, ExprValue B) {
return A.getValue() >> B.getValue(); return A.getValue() >> B.getValue();
} }
static ExprValue bitAnd(ExprValue A, ExprValue B) { static ExprValue bitAnd(ExprValue A, ExprValue B) {
moveAbsRight(A, B); moveAbsRight(A, B);
return {A.Sec, A.ForceAbsolute, return {A.Sec, A.ForceAbsolute,
(A.getValue() & B.getValue()) - A.getSecAddr()}; (A.getValue() & B.getValue()) - A.getSecAddr()};
} }
static ExprValue bitOr(ExprValue A, ExprValue B) { static ExprValue bitOr(ExprValue A, ExprValue B) {
moveAbsRight(A, B); moveAbsRight(A, B);
return {A.Sec, A.ForceAbsolute, return {A.Sec, A.ForceAbsolute,
(A.getValue() | B.getValue()) - A.getSecAddr()}; (A.getValue() | B.getValue()) - A.getSecAddr()};
} }
static ExprValue bitNot(ExprValue A) { return ~A.getValue(); } static ExprValue bitNot(ExprValue A) { return ~A.getValue(); }
static ExprValue minus(ExprValue A) { return -A.getValue(); } static ExprValue minus(ExprValue A) { return -A.getValue(); }