private ConstantWrapper UnsignedRightShift(ConstantWrapper left, ConstantWrapper right) { ConstantWrapper newLiteral = null; if (m_parser.Settings.IsModificationAllowed(TreeModifications.EvaluateNumericExpressions)) { try { // left-hand value is a 32-bit signed integer UInt32 lvalue = left.ToUInt32(); // mask only the bottom 5 bits of the right-hand value int rvalue = (int)(right.ToUInt32() & 0x1F); // convert the result to a double double result = Convert.ToDouble(lvalue >> rvalue); newLiteral = new ConstantWrapper(result, PrimitiveType.Number, null, m_parser); } catch (InvalidCastException) { // some kind of casting in ToNumber caused a situation where we don't want // to perform the combination on these operands } } return newLiteral; }