Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -33,7 +33,7 @@
// https://github.com/dotnet/corefx
// src/System.Console/src/System/ConsolePal.Unix.cs
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
//
// Defining this writes the output to console.log
@@ -1556,22 +1556,52 @@ namespace System {
case 'O': // logical
int second = stack.Pop().Int32; // it's a stack... the second value was pushed last
int first = stack.Pop().Int32;
char c = format[pos];
stack.Push(
c == '+' ? (first + second) :
c == '-' ? (first - second) :
c == '*' ? (first * second) :
c == '/' ? (first / second) :
c == 'm' ? (first % second) :
c == '^' ? (first ^ second) :
c == '&' ? (first & second) :
c == '|' ? (first | second) :
c == '=' ? AsInt(first == second) :
c == '>' ? AsInt(first > second) :
c == '<' ? AsInt(first < second) :
c == 'A' ? AsInt(AsBool(first) && AsBool(second)) :
c == 'O' ? AsInt(AsBool(first) || AsBool(second)) :
0); // not possible; we just validated above
int res;
switch (format[pos]) {
case '+':
res = first + second;
break;
case '-':
res = first - second;
break;
case '*':
res = first * second;
break;
case '/':
res = first / second;
break;
case 'm':
res = first % second;
break;
case '^':
res = first ^ second;
break;
case '&':
res = first & second;
break;
case '|':
res = first | second;
break;
case '=':
res = AsInt(first == second);
break;
case '>':
res = AsInt(first > second);
break;
case '<':
res = AsInt(first < second);
break;
case 'A':
res = AsInt(AsBool(first) && AsBool(second));
break;
case 'O':
res = AsInt(AsBool(first) || AsBool(second));
break;
default:
res = 0;
break;
}
stack.Push(res);
break;
// Unary operations