@ -390,14 +390,14 @@ namespace Mono.CSharp {
return new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
return new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
}
}
if ( left is FloatConstant ) {
if ( left is FloatConstant ) {
float res ;
double a , b , res ;
a = ( ( FloatConstant ) left ) . DoubleValue ;
b = ( ( FloatConstant ) right ) . DoubleValue ;
if ( ec . ConstantCheckState )
if ( ec . ConstantCheckState )
res = checked ( ( ( FloatConstant ) left ) . Value +
res = checked ( a + b ) ;
( ( FloatConstant ) right ) . Value ) ;
else
else
res = unchecked ( ( ( FloatConstant ) left ) . Value +
res = unchecked ( a + b ) ;
( ( FloatConstant ) right ) . Value ) ;
result = new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
result = new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
} else if ( left is ULongConstant ) {
} else if ( left is ULongConstant ) {
@ -514,14 +514,14 @@ namespace Mono.CSharp {
result = new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
result = new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
} else if ( left is FloatConstant ) {
} else if ( left is FloatConstant ) {
float res ;
double a , b , res ;
a = ( ( FloatConstant ) left ) . DoubleValue ;
b = ( ( FloatConstant ) right ) . DoubleValue ;
if ( ec . ConstantCheckState )
if ( ec . ConstantCheckState )
res = checked ( ( ( FloatConstant ) left ) . Value -
res = checked ( a - b ) ;
( ( FloatConstant ) right ) . Value ) ;
else
else
res = unchecked ( ( ( FloatConstant ) left ) . Value -
res = unchecked ( a - b ) ;
( ( FloatConstant ) right ) . Value ) ;
result = new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
result = new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
} else if ( left is ULongConstant ) {
} else if ( left is ULongConstant ) {
@ -611,14 +611,14 @@ namespace Mono.CSharp {
return new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
return new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
} else if ( left is FloatConstant ) {
} else if ( left is FloatConstant ) {
float res ;
double a , b , res ;
a = ( ( FloatConstant ) left ) . DoubleValue ;
b = ( ( FloatConstant ) right ) . DoubleValue ;
if ( ec . ConstantCheckState )
if ( ec . ConstantCheckState )
res = checked ( ( ( FloatConstant ) left ) . Value *
res = checked ( a * b ) ;
( ( FloatConstant ) right ) . Value ) ;
else
else
res = unchecked ( ( ( FloatConstant ) left ) . Value *
res = unchecked ( a * b ) ;
( ( FloatConstant ) right ) . Value ) ;
return new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
return new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
} else if ( left is ULongConstant ) {
} else if ( left is ULongConstant ) {
@ -707,14 +707,14 @@ namespace Mono.CSharp {
return new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
return new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
} else if ( left is FloatConstant ) {
} else if ( left is FloatConstant ) {
float res ;
double a , b , res ;
a = ( ( FloatConstant ) left ) . DoubleValue ;
b = ( ( FloatConstant ) right ) . DoubleValue ;
if ( ec . ConstantCheckState )
if ( ec . ConstantCheckState )
res = checked ( ( ( FloatConstant ) left ) . Value /
res = checked ( a / b ) ;
( ( FloatConstant ) right ) . Value ) ;
else
else
res = unchecked ( ( ( FloatConstant ) left ) . Value /
res = unchecked ( a / b ) ;
( ( FloatConstant ) right ) . Value ) ;
return new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
return new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
} else if ( left is ULongConstant ) {
} else if ( left is ULongConstant ) {
@ -807,14 +807,14 @@ namespace Mono.CSharp {
return new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
return new DoubleConstant ( ec . BuiltinTypes , res , left . Location ) ;
} else if ( left is FloatConstant ) {
} else if ( left is FloatConstant ) {
float res ;
double a , b , res ;
a = ( ( FloatConstant ) left ) . DoubleValue ;
b = ( ( FloatConstant ) right ) . DoubleValue ;
if ( ec . ConstantCheckState )
if ( ec . ConstantCheckState )
res = checked ( ( ( FloatConstant ) left ) . Value %
res = checked ( a % b ) ;
( ( FloatConstant ) right ) . Value ) ;
else
else
res = unchecked ( ( ( FloatConstant ) left ) . Value %
res = unchecked ( a % b ) ;
( ( FloatConstant ) right ) . Value ) ;
return new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
return new FloatConstant ( ec . BuiltinTypes , res , left . Location ) ;
} else if ( left is ULongConstant ) {
} else if ( left is ULongConstant ) {
@ -883,7 +883,6 @@ namespace Mono.CSharp {
IntConstant ic = right . ConvertImplicitly ( ec . BuiltinTypes . Int ) as IntConstant ;
IntConstant ic = right . ConvertImplicitly ( ec . BuiltinTypes . Int ) as IntConstant ;
if ( ic = = null ) {
if ( ic = = null ) {
Binary . Error_OperatorCannotBeApplied ( ec , left , right , oper , loc ) ;
return null ;
return null ;
}
}
@ -905,8 +904,7 @@ namespace Mono.CSharp {
if ( left . Type . BuiltinType = = BuiltinTypeSpec . Type . Int )
if ( left . Type . BuiltinType = = BuiltinTypeSpec . Type . Int )
return new IntConstant ( ec . BuiltinTypes , ( ( IntConstant ) left ) . Value < < lshift_val , left . Location ) ;
return new IntConstant ( ec . BuiltinTypes , ( ( IntConstant ) left ) . Value < < lshift_val , left . Location ) ;
Binary . Error_OperatorCannotBeApplied ( ec , left , right , oper , loc ) ;
return null ;
break ;
//
//
// There is no overflow checking on right shift
// There is no overflow checking on right shift
@ -920,7 +918,6 @@ namespace Mono.CSharp {
IntConstant sic = right . ConvertImplicitly ( ec . BuiltinTypes . Int ) as IntConstant ;
IntConstant sic = right . ConvertImplicitly ( ec . BuiltinTypes . Int ) as IntConstant ;
if ( sic = = null ) {
if ( sic = = null ) {
Binary . Error_OperatorCannotBeApplied ( ec , left , right , oper , loc ) ;
return null ;
return null ;
}
}
int rshift_val = sic . Value ;
int rshift_val = sic . Value ;
@ -941,8 +938,7 @@ namespace Mono.CSharp {
if ( left . Type . BuiltinType = = BuiltinTypeSpec . Type . Int )
if ( left . Type . BuiltinType = = BuiltinTypeSpec . Type . Int )
return new IntConstant ( ec . BuiltinTypes , ( ( IntConstant ) left ) . Value > > rshift_val , left . Location ) ;
return new IntConstant ( ec . BuiltinTypes , ( ( IntConstant ) left ) . Value > > rshift_val , left . Location ) ;
Binary . Error_OperatorCannotBeApplied ( ec , left , right , oper , loc ) ;
return null ;
break ;
case Binary . Operator . Equality :
case Binary . Operator . Equality :
if ( TypeSpec . IsReferenceType ( lt ) & & TypeSpec . IsReferenceType ( rt ) | |
if ( TypeSpec . IsReferenceType ( lt ) & & TypeSpec . IsReferenceType ( rt ) | |
@ -969,8 +965,8 @@ namespace Mono.CSharp {
bool_res = ( ( DoubleConstant ) left ) . Value = =
bool_res = ( ( DoubleConstant ) left ) . Value = =
( ( DoubleConstant ) right ) . Value ;
( ( DoubleConstant ) right ) . Value ;
else if ( left is FloatConstant )
else if ( left is FloatConstant )
bool_res = ( ( FloatConstant ) left ) . Value = =
bool_res = ( ( FloatConstant ) left ) . Double Value = =
( ( FloatConstant ) right ) . Value ;
( ( FloatConstant ) right ) . Double Value;
else if ( left is ULongConstant )
else if ( left is ULongConstant )
bool_res = ( ( ULongConstant ) left ) . Value = =
bool_res = ( ( ULongConstant ) left ) . Value = =
( ( ULongConstant ) right ) . Value ;
( ( ULongConstant ) right ) . Value ;
@ -1013,8 +1009,8 @@ namespace Mono.CSharp {
bool_res = ( ( DoubleConstant ) left ) . Value ! =
bool_res = ( ( DoubleConstant ) left ) . Value ! =
( ( DoubleConstant ) right ) . Value ;
( ( DoubleConstant ) right ) . Value ;
else if ( left is FloatConstant )
else if ( left is FloatConstant )
bool_res = ( ( FloatConstant ) left ) . Value ! =
bool_res = ( ( FloatConstant ) left ) . Double Value ! =
( ( FloatConstant ) right ) . Value ;
( ( FloatConstant ) right ) . Double Value;
else if ( left is ULongConstant )
else if ( left is ULongConstant )
bool_res = ( ( ULongConstant ) left ) . Value ! =
bool_res = ( ( ULongConstant ) left ) . Value ! =
( ( ULongConstant ) right ) . Value ;
( ( ULongConstant ) right ) . Value ;
@ -1049,8 +1045,8 @@ namespace Mono.CSharp {
bool_res = ( ( DoubleConstant ) left ) . Value <
bool_res = ( ( DoubleConstant ) left ) . Value <
( ( DoubleConstant ) right ) . Value ;
( ( DoubleConstant ) right ) . Value ;
else if ( left is FloatConstant )
else if ( left is FloatConstant )
bool_res = ( ( FloatConstant ) left ) . Value <
bool_res = ( ( FloatConstant ) left ) . Double Value <
( ( FloatConstant ) right ) . Value ;
( ( FloatConstant ) right ) . Double Value;
else if ( left is ULongConstant )
else if ( left is ULongConstant )
bool_res = ( ( ULongConstant ) left ) . Value <
bool_res = ( ( ULongConstant ) left ) . Value <
( ( ULongConstant ) right ) . Value ;
( ( ULongConstant ) right ) . Value ;
@ -1085,8 +1081,8 @@ namespace Mono.CSharp {
bool_res = ( ( DoubleConstant ) left ) . Value >
bool_res = ( ( DoubleConstant ) left ) . Value >
( ( DoubleConstant ) right ) . Value ;
( ( DoubleConstant ) right ) . Value ;
else if ( left is FloatConstant )
else if ( left is FloatConstant )
bool_res = ( ( FloatConstant ) left ) . Value >
bool_res = ( ( FloatConstant ) left ) . Double Value >
( ( FloatConstant ) right ) . Value ;
( ( FloatConstant ) right ) . Double Value;
else if ( left is ULongConstant )
else if ( left is ULongConstant )
bool_res = ( ( ULongConstant ) left ) . Value >
bool_res = ( ( ULongConstant ) left ) . Value >
( ( ULongConstant ) right ) . Value ;
( ( ULongConstant ) right ) . Value ;
@ -1121,8 +1117,8 @@ namespace Mono.CSharp {
bool_res = ( ( DoubleConstant ) left ) . Value > =
bool_res = ( ( DoubleConstant ) left ) . Value > =
( ( DoubleConstant ) right ) . Value ;
( ( DoubleConstant ) right ) . Value ;
else if ( left is FloatConstant )
else if ( left is FloatConstant )
bool_res = ( ( FloatConstant ) left ) . Value > =
bool_res = ( ( FloatConstant ) left ) . Double Value > =
( ( FloatConstant ) right ) . Value ;
( ( FloatConstant ) right ) . Double Value;
else if ( left is ULongConstant )
else if ( left is ULongConstant )
bool_res = ( ( ULongConstant ) left ) . Value > =
bool_res = ( ( ULongConstant ) left ) . Value > =
( ( ULongConstant ) right ) . Value ;
( ( ULongConstant ) right ) . Value ;
@ -1157,8 +1153,8 @@ namespace Mono.CSharp {
bool_res = ( ( DoubleConstant ) left ) . Value < =
bool_res = ( ( DoubleConstant ) left ) . Value < =
( ( DoubleConstant ) right ) . Value ;
( ( DoubleConstant ) right ) . Value ;
else if ( left is FloatConstant )
else if ( left is FloatConstant )
bool_res = ( ( FloatConstant ) left ) . Value < =
bool_res = ( ( FloatConstant ) left ) . Double Value < =
( ( FloatConstant ) right ) . Value ;
( ( FloatConstant ) right ) . Double Value;
else if ( left is ULongConstant )
else if ( left is ULongConstant )
bool_res = ( ( ULongConstant ) left ) . Value < =
bool_res = ( ( ULongConstant ) left ) . Value < =
( ( ULongConstant ) right ) . Value ;
( ( ULongConstant ) right ) . Value ;