ZoneCodeGenerator: Add bitwise and, or, xor operations

This commit is contained in:
Jan 2019-10-27 01:45:34 +02:00
parent 86f754bdd7
commit 49883bfce3

View File

@ -17,8 +17,11 @@ namespace ZoneCodeGenerator.Domain.Evaluation
BitwiseShift = 3,
RelationalGreaterLessThan = 4,
RelationalEquals = 5,
LogicalAnd = 6,
LogicalOr = 7
BitwiseAnd = 6,
BitwiseXor = 7,
BitwiseOr = 8,
LogicalAnd = 9,
LogicalOr = 10
}
public delegate int EvaluationFunction(int operand1, int operand2);
@ -69,6 +72,24 @@ namespace ZoneCodeGenerator.Domain.Evaluation
(operand1, operand2) => operand1 % operand2
);
public static OperationType OperationBitwiseAnd = new OperationType(
"&",
OperationPrecedence.BitwiseAnd,
(operand1, operand2) => operand1 & operand2
);
public static OperationType OperationBitwiseXor = new OperationType(
"^",
OperationPrecedence.BitwiseXor,
(operand1, operand2) => operand1 ^ operand2
);
public static OperationType OperationBitwiseOr = new OperationType(
"|",
OperationPrecedence.BitwiseOr,
(operand1, operand2) => operand1 | operand2
);
public static OperationType OperationShiftLeft = new OperationType(
"<<",
OperationPrecedence.BitwiseShift,