2 // cfold.cs: Constant Folding
5 // Miguel de Icaza (miguel@ximian.com)
7 // (C) 2002 Ximian, Inc.
12 namespace Mono.CSharp {
14 public class ConstantFold {
17 // Performs the numeric promotions on the left and right expresions
18 // and desposits the results on `lc' and `rc'.
20 // On success, the types of `lc' and `rc' on output will always match,
21 // and the pair will be one of:
30 static void DoConstantNumericPromotions (Binary.Operator oper,
31 ref Constant left, ref Constant right,
34 if (left is DoubleConstant || right is DoubleConstant){
36 // If either side is a double, convert the other to a double
38 if (!(left is DoubleConstant))
39 left = left.ToDouble (true, loc);
41 if (!(right is DoubleConstant))
42 right = right.ToDouble (true, loc);
44 } else if (left is FloatConstant || right is FloatConstant) {
46 // If either side is a float, convert the other to a float
48 if (!(left is FloatConstant))
49 left = left.ToFloat (true, loc);
51 if (!(right is FloatConstant))
52 right = right.ToFloat (true, loc);
54 } else if (left is ULongConstant || right is ULongConstant){
56 // If either operand is of type ulong, the other operand is
57 // converted to type ulong. or an error ocurrs if the other
58 // operand is of type sbyte, short, int or long
60 Constant match, other;
62 if (left is ULongConstant){
65 if (!(right is ULongConstant))
66 right = right.ToULong (true, loc);
70 left = left.ToULong (true, loc);
73 if (other is SByteConstant || other is ShortConstant ||
74 other is IntConstant || other is LongConstant){
75 Binary.Error_OperatorAmbiguous
76 (loc, oper, other.Type, match.Type);
81 } else if (left is LongConstant || right is LongConstant){
83 // If either operand is of type long, the other operand is converted
86 if (!(left is LongConstant))
87 left = left.ToLong (true, loc);
88 else if (!(right is LongConstant))
89 right = right.ToLong (true, loc);
91 } else if (left is UIntConstant || right is UIntConstant){
93 // If either operand is of type uint, and the other
94 // operand is of type sbyte, short or int, othe operands are
95 // converted to type long.
97 if (!(left is UIntConstant))
98 left = left.ToUInt (true, loc);
99 else if (!(right is UIntConstant))
100 right = right.ToUInt (true, loc);
104 // Force conversions to int32
106 if (!(left is IntConstant))
107 left = left.ToInt (true, loc);
108 if (!(right is IntConstant))
109 right = right.ToInt (true, loc);
114 static void Error_CompileTimeOverflow (Location loc)
116 Report.Error (220, loc, "The operation overflows at compile time in checked mode");
120 /// Constant expression folder for binary operations.
122 /// Returns null if the expression can not be folded.
124 static public Expression BinaryFold (EmitContext ec, Binary.Operator oper,
125 Constant left, Constant right, Location loc)
128 Type rt = right.Type;
129 Type result_type = null;
133 // Enumerator folding
135 if (rt == lt && left is EnumConstant)
139 case Binary.Operator.BitwiseOr:
140 DoConstantNumericPromotions (oper, ref left, ref right, loc);
141 if (left == null || right == null)
144 if (left is IntConstant){
146 int res = ((IntConstant) left).Value | ((IntConstant) right).Value;
148 v = new IntConstant (res);
149 if (result_type == null)
152 return new EnumConstant (v, result_type);
153 } else if (left is UIntConstant){
155 uint res = ((UIntConstant)left).Value | ((UIntConstant)right).Value;
157 v = new UIntConstant (res);
158 if (result_type == null)
161 return new EnumConstant (v, result_type);
162 } else if (left is LongConstant){
164 long res = ((LongConstant)left).Value | ((LongConstant)right).Value;
166 v = new LongConstant (res);
167 if (result_type == null)
170 return new EnumConstant (v, result_type);
171 } else if (left is ULongConstant){
173 ulong res = ((ULongConstant)left).Value |
174 ((ULongConstant)right).Value;
176 v = new ULongConstant (res);
177 if (result_type == null)
180 return new EnumConstant (v, result_type);
184 case Binary.Operator.BitwiseAnd:
185 DoConstantNumericPromotions (oper, ref left, ref right, loc);
186 if (left == null || right == null)
189 if (left is IntConstant){
191 int res = ((IntConstant) left).Value & ((IntConstant) right).Value;
193 v = new IntConstant (res);
194 if (result_type == null)
197 return new EnumConstant (v, result_type);
198 } else if (left is UIntConstant){
200 uint res = ((UIntConstant)left).Value & ((UIntConstant)right).Value;
202 v = new UIntConstant (res);
203 if (result_type == null)
206 return new EnumConstant (v, result_type);
207 } else if (left is LongConstant){
209 long res = ((LongConstant)left).Value & ((LongConstant)right).Value;
211 v = new LongConstant (res);
212 if (result_type == null)
215 return new EnumConstant (v, result_type);
216 } else if (left is ULongConstant){
218 ulong res = ((ULongConstant)left).Value &
219 ((ULongConstant)right).Value;
221 v = new ULongConstant (res);
222 if (result_type == null)
225 return new EnumConstant (v, result_type);
229 case Binary.Operator.ExclusiveOr:
230 DoConstantNumericPromotions (oper, ref left, ref right, loc);
231 if (left == null || right == null)
234 if (left is IntConstant){
236 int res = ((IntConstant) left).Value ^ ((IntConstant) right).Value;
238 v = new IntConstant (res);
239 if (result_type == null)
242 return new EnumConstant (v, result_type);
243 } else if (left is UIntConstant){
245 uint res = ((UIntConstant)left).Value ^ ((UIntConstant)right).Value;
247 v = new UIntConstant (res);
248 if (result_type == null)
251 return new EnumConstant (v, result_type);
252 } else if (left is LongConstant){
254 long res = ((LongConstant)left).Value ^ ((LongConstant)right).Value;
256 v = new LongConstant (res);
257 if (result_type == null)
260 return new EnumConstant (v, result_type);
261 } else if (left is ULongConstant){
263 ulong res = ((ULongConstant)left).Value ^
264 ((ULongConstant)right).Value;
266 v = new ULongConstant (res);
267 if (result_type == null)
270 return new EnumConstant (v, result_type);
274 case Binary.Operator.Addition:
275 if (left is StringConstant && right is StringConstant)
276 return new StringConstant (
277 ((StringConstant) left).Value +
278 ((StringConstant) right).Value);
280 DoConstantNumericPromotions (oper, ref left, ref right, loc);
281 if (left == null || right == null)
285 if (left is DoubleConstant){
288 if (ec.ConstantCheckState)
289 res = checked (((DoubleConstant) left).Value +
290 ((DoubleConstant) right).Value);
292 res = unchecked (((DoubleConstant) left).Value +
293 ((DoubleConstant) right).Value);
295 return new DoubleConstant (res);
296 } else if (left is FloatConstant){
299 if (ec.ConstantCheckState)
300 res = checked (((FloatConstant) left).Value +
301 ((FloatConstant) right).Value);
303 res = unchecked (((FloatConstant) left).Value +
304 ((FloatConstant) right).Value);
306 return new FloatConstant (res);
307 } else if (left is ULongConstant){
310 if (ec.ConstantCheckState)
311 res = checked (((ULongConstant) left).Value +
312 ((ULongConstant) right).Value);
314 res = unchecked (((ULongConstant) left).Value +
315 ((ULongConstant) right).Value);
317 return new ULongConstant (res);
318 } else if (left is LongConstant){
321 if (ec.ConstantCheckState)
322 res = checked (((LongConstant) left).Value +
323 ((LongConstant) right).Value);
325 res = unchecked (((LongConstant) left).Value +
326 ((LongConstant) right).Value);
328 return new LongConstant (res);
329 } else if (left is UIntConstant){
332 if (ec.ConstantCheckState)
333 res = checked (((UIntConstant) left).Value +
334 ((UIntConstant) right).Value);
336 res = unchecked (((UIntConstant) left).Value +
337 ((UIntConstant) right).Value);
339 return new UIntConstant (res);
340 } else if (left is IntConstant){
343 if (ec.ConstantCheckState)
344 res = checked (((IntConstant) left).Value +
345 ((IntConstant) right).Value);
347 res = unchecked (((IntConstant) left).Value +
348 ((IntConstant) right).Value);
350 return new IntConstant (res);
352 throw new Exception ( "Unexepected input: " + left);
354 } catch (OverflowException){
355 Error_CompileTimeOverflow (loc);
359 case Binary.Operator.Subtraction:
360 DoConstantNumericPromotions (oper, ref left, ref right, loc);
361 if (left == null || right == null)
365 if (left is DoubleConstant){
368 if (ec.ConstantCheckState)
369 res = checked (((DoubleConstant) left).Value -
370 ((DoubleConstant) right).Value);
372 res = unchecked (((DoubleConstant) left).Value -
373 ((DoubleConstant) right).Value);
375 return new DoubleConstant (res);
376 } else if (left is FloatConstant){
379 if (ec.ConstantCheckState)
380 res = checked (((FloatConstant) left).Value -
381 ((FloatConstant) right).Value);
383 res = unchecked (((FloatConstant) left).Value -
384 ((FloatConstant) right).Value);
386 return new FloatConstant (res);
387 } else if (left is ULongConstant){
390 if (ec.ConstantCheckState)
391 res = checked (((ULongConstant) left).Value -
392 ((ULongConstant) right).Value);
394 res = unchecked (((ULongConstant) left).Value -
395 ((ULongConstant) right).Value);
397 return new ULongConstant (res);
398 } else if (left is LongConstant){
401 if (ec.ConstantCheckState)
402 res = checked (((LongConstant) left).Value -
403 ((LongConstant) right).Value);
405 res = unchecked (((LongConstant) left).Value -
406 ((LongConstant) right).Value);
408 return new LongConstant (res);
409 } else if (left is UIntConstant){
412 if (ec.ConstantCheckState)
413 res = checked (((UIntConstant) left).Value -
414 ((UIntConstant) right).Value);
416 res = unchecked (((UIntConstant) left).Value -
417 ((UIntConstant) right).Value);
419 return new UIntConstant (res);
420 } else if (left is IntConstant){
423 if (ec.ConstantCheckState)
424 res = checked (((IntConstant) left).Value -
425 ((IntConstant) right).Value);
427 res = unchecked (((IntConstant) left).Value -
428 ((IntConstant) right).Value);
430 return new IntConstant (res);
432 throw new Exception ( "Unexepected input: " + left);
434 } catch (OverflowException){
435 Error_CompileTimeOverflow (loc);
439 case Binary.Operator.Multiply:
440 DoConstantNumericPromotions (oper, ref left, ref right, loc);
441 if (left == null || right == null)
445 if (left is DoubleConstant){
448 if (ec.ConstantCheckState)
449 res = checked (((DoubleConstant) left).Value *
450 ((DoubleConstant) right).Value);
452 res = unchecked (((DoubleConstant) left).Value *
453 ((DoubleConstant) right).Value);
455 return new DoubleConstant (res);
456 } else if (left is FloatConstant){
459 if (ec.ConstantCheckState)
460 res = checked (((FloatConstant) left).Value *
461 ((FloatConstant) right).Value);
463 res = unchecked (((FloatConstant) left).Value *
464 ((FloatConstant) right).Value);
466 return new FloatConstant (res);
467 } else if (left is ULongConstant){
470 if (ec.ConstantCheckState)
471 res = checked (((ULongConstant) left).Value *
472 ((ULongConstant) right).Value);
474 res = unchecked (((ULongConstant) left).Value *
475 ((ULongConstant) right).Value);
477 return new ULongConstant (res);
478 } else if (left is LongConstant){
481 if (ec.ConstantCheckState)
482 res = checked (((LongConstant) left).Value *
483 ((LongConstant) right).Value);
485 res = unchecked (((LongConstant) left).Value *
486 ((LongConstant) right).Value);
488 return new LongConstant (res);
489 } else if (left is UIntConstant){
492 if (ec.ConstantCheckState)
493 res = checked (((UIntConstant) left).Value *
494 ((UIntConstant) right).Value);
496 res = unchecked (((UIntConstant) left).Value *
497 ((UIntConstant) right).Value);
499 return new UIntConstant (res);
500 } else if (left is IntConstant){
503 if (ec.ConstantCheckState)
504 res = checked (((IntConstant) left).Value *
505 ((IntConstant) right).Value);
507 res = unchecked (((IntConstant) left).Value *
508 ((IntConstant) right).Value);
510 return new IntConstant (res);
512 throw new Exception ( "Unexepected input: " + left);
514 } catch (OverflowException){
515 Error_CompileTimeOverflow (loc);
519 case Binary.Operator.Division:
520 DoConstantNumericPromotions (oper, ref left, ref right, loc);
521 if (left == null || right == null)
525 if (left is DoubleConstant){
528 if (ec.ConstantCheckState)
529 res = checked (((DoubleConstant) left).Value /
530 ((DoubleConstant) right).Value);
532 res = unchecked (((DoubleConstant) left).Value /
533 ((DoubleConstant) right).Value);
535 return new DoubleConstant (res);
536 } else if (left is FloatConstant){
539 if (ec.ConstantCheckState)
540 res = checked (((FloatConstant) left).Value /
541 ((FloatConstant) right).Value);
543 res = unchecked (((FloatConstant) left).Value /
544 ((FloatConstant) right).Value);
546 return new FloatConstant (res);
547 } else if (left is ULongConstant){
550 if (ec.ConstantCheckState)
551 res = checked (((ULongConstant) left).Value /
552 ((ULongConstant) right).Value);
554 res = unchecked (((ULongConstant) left).Value /
555 ((ULongConstant) right).Value);
557 return new ULongConstant (res);
558 } else if (left is LongConstant){
561 if (ec.ConstantCheckState)
562 res = checked (((LongConstant) left).Value /
563 ((LongConstant) right).Value);
565 res = unchecked (((LongConstant) left).Value /
566 ((LongConstant) right).Value);
568 return new LongConstant (res);
569 } else if (left is UIntConstant){
572 if (ec.ConstantCheckState)
573 res = checked (((UIntConstant) left).Value /
574 ((UIntConstant) right).Value);
576 res = unchecked (((UIntConstant) left).Value /
577 ((UIntConstant) right).Value);
579 return new UIntConstant (res);
580 } else if (left is IntConstant){
583 if (ec.ConstantCheckState)
584 res = checked (((IntConstant) left).Value /
585 ((IntConstant) right).Value);
587 res = unchecked (((IntConstant) left).Value /
588 ((IntConstant) right).Value);
590 return new IntConstant (res);
592 throw new Exception ( "Unexepected input: " + left);
594 } catch (OverflowException){
595 Error_CompileTimeOverflow (loc);
599 case Binary.Operator.Modulus:
600 DoConstantNumericPromotions (oper, ref left, ref right, loc);
601 if (left == null || right == null)
605 if (left is DoubleConstant){
608 if (ec.ConstantCheckState)
609 res = checked (((DoubleConstant) left).Value %
610 ((DoubleConstant) right).Value);
612 res = unchecked (((DoubleConstant) left).Value %
613 ((DoubleConstant) right).Value);
615 return new DoubleConstant (res);
616 } else if (left is FloatConstant){
619 if (ec.ConstantCheckState)
620 res = checked (((FloatConstant) left).Value %
621 ((FloatConstant) right).Value);
623 res = unchecked (((FloatConstant) left).Value %
624 ((FloatConstant) right).Value);
626 return new FloatConstant (res);
627 } else if (left is ULongConstant){
630 if (ec.ConstantCheckState)
631 res = checked (((ULongConstant) left).Value %
632 ((ULongConstant) right).Value);
634 res = unchecked (((ULongConstant) left).Value %
635 ((ULongConstant) right).Value);
637 return new ULongConstant (res);
638 } else if (left is LongConstant){
641 if (ec.ConstantCheckState)
642 res = checked (((LongConstant) left).Value %
643 ((LongConstant) right).Value);
645 res = unchecked (((LongConstant) left).Value %
646 ((LongConstant) right).Value);
648 return new LongConstant (res);
649 } else if (left is UIntConstant){
652 if (ec.ConstantCheckState)
653 res = checked (((UIntConstant) left).Value %
654 ((UIntConstant) right).Value);
656 res = unchecked (((UIntConstant) left).Value %
657 ((UIntConstant) right).Value);
659 return new UIntConstant (res);
660 } else if (left is IntConstant){
663 if (ec.ConstantCheckState)
664 res = checked (((IntConstant) left).Value %
665 ((IntConstant) right).Value);
667 res = unchecked (((IntConstant) left).Value %
668 ((IntConstant) right).Value);
670 return new IntConstant (res);
672 throw new Exception ( "Unexepected input: " + left);
674 } catch (OverflowException){
675 Error_CompileTimeOverflow (loc);
680 // There is no overflow checking on left shift
682 case Binary.Operator.LeftShift:
683 IntConstant ic = right.ToInt (true, loc);
685 Binary.Error_OperatorCannotBeApplied (loc, "<<", lt, rt);
688 int lshift_val = ic.Value;
691 if ((lic = left.ConvertToInt (true)) != null)
692 return new IntConstant (lic.Value << lshift_val);
695 if ((luic = left.ConvertToUInt (true)) != null)
696 return new UIntConstant (luic.Value << lshift_val);
699 if ((llc = left.ConvertToLong (true)) != null)
700 return new LongConstant (llc.Value << lshift_val);
703 if ((lulc = left.ConvertToULong (true)) != null)
704 return new ULongConstant (lulc.Value << lshift_val);
706 Binary.Error_OperatorCannotBeApplied (loc, "<<", lt, rt);
710 // There is no overflow checking on right shift
712 case Binary.Operator.RightShift:
713 IntConstant sic = right.ToInt (true, loc);
715 Binary.Error_OperatorCannotBeApplied (loc, ">>", lt, rt);
718 int rshift_val = sic.Value;
721 if ((ric = left.ConvertToInt (true)) != null)
722 return new IntConstant (ric.Value >> rshift_val);
725 if ((ruic = left.ConvertToUInt (true)) != null)
726 return new UIntConstant (ruic.Value >> rshift_val);
729 if ((rlc = left.ConvertToLong (true)) != null)
730 return new LongConstant (rlc.Value >> rshift_val);
733 if ((rulc = left.ConvertToULong (true)) != null)
734 return new ULongConstant (rulc.Value >> rshift_val);
736 Binary.Error_OperatorCannotBeApplied (loc, ">>", lt, rt);
739 case Binary.Operator.LogicalAnd:
740 if (left is BoolConstant && right is BoolConstant){
741 return new BoolConstant (
742 ((BoolConstant) left).Value &&
743 ((BoolConstant) right).Value);
747 case Binary.Operator.LogicalOr:
748 if (left is BoolConstant && right is BoolConstant){
749 return new BoolConstant (
750 ((BoolConstant) left).Value ||
751 ((BoolConstant) right).Value);
755 case Binary.Operator.Equality:
756 if (left is BoolConstant && right is BoolConstant){
757 return new BoolConstant (
758 ((BoolConstant) left).Value ==
759 ((BoolConstant) right).Value);
762 if (left is StringConstant && right is StringConstant){
763 return new BoolConstant (
764 ((StringConstant) left).Value ==
765 ((StringConstant) right).Value);
769 DoConstantNumericPromotions (oper, ref left, ref right, loc);
770 if (left == null || right == null)
774 if (left is DoubleConstant)
775 bool_res = ((DoubleConstant) left).Value ==
776 ((DoubleConstant) right).Value;
777 else if (left is FloatConstant)
778 bool_res = ((FloatConstant) left).Value ==
779 ((FloatConstant) right).Value;
780 else if (left is ULongConstant)
781 bool_res = ((ULongConstant) left).Value ==
782 ((ULongConstant) right).Value;
783 else if (left is LongConstant)
784 bool_res = ((LongConstant) left).Value ==
785 ((LongConstant) right).Value;
786 else if (left is UIntConstant)
787 bool_res = ((UIntConstant) left).Value ==
788 ((UIntConstant) right).Value;
789 else if (left is IntConstant)
790 bool_res = ((IntConstant) left).Value ==
791 ((IntConstant) right).Value;
795 return new BoolConstant (bool_res);
797 case Binary.Operator.Inequality:
798 if (left is BoolConstant && right is BoolConstant){
799 return new BoolConstant (
800 ((BoolConstant) left).Value !=
801 ((BoolConstant) right).Value);
803 if (left is StringConstant && right is StringConstant){
804 return new BoolConstant (
805 ((StringConstant) left).Value !=
806 ((StringConstant) right).Value);
809 DoConstantNumericPromotions (oper, ref left, ref right, loc);
810 if (left == null || right == null)
814 if (left is DoubleConstant)
815 bool_res = ((DoubleConstant) left).Value !=
816 ((DoubleConstant) right).Value;
817 else if (left is FloatConstant)
818 bool_res = ((FloatConstant) left).Value !=
819 ((FloatConstant) right).Value;
820 else if (left is ULongConstant)
821 bool_res = ((ULongConstant) left).Value !=
822 ((ULongConstant) right).Value;
823 else if (left is LongConstant)
824 bool_res = ((LongConstant) left).Value !=
825 ((LongConstant) right).Value;
826 else if (left is UIntConstant)
827 bool_res = ((UIntConstant) left).Value !=
828 ((UIntConstant) right).Value;
829 else if (left is IntConstant)
830 bool_res = ((IntConstant) left).Value !=
831 ((IntConstant) right).Value;
835 return new BoolConstant (bool_res);
837 case Binary.Operator.LessThan:
838 DoConstantNumericPromotions (oper, ref left, ref right, loc);
839 if (left == null || right == null)
843 if (left is DoubleConstant)
844 bool_res = ((DoubleConstant) left).Value <
845 ((DoubleConstant) right).Value;
846 else if (left is FloatConstant)
847 bool_res = ((FloatConstant) left).Value <
848 ((FloatConstant) right).Value;
849 else if (left is ULongConstant)
850 bool_res = ((ULongConstant) left).Value <
851 ((ULongConstant) right).Value;
852 else if (left is LongConstant)
853 bool_res = ((LongConstant) left).Value <
854 ((LongConstant) right).Value;
855 else if (left is UIntConstant)
856 bool_res = ((UIntConstant) left).Value <
857 ((UIntConstant) right).Value;
858 else if (left is IntConstant)
859 bool_res = ((IntConstant) left).Value <
860 ((IntConstant) right).Value;
864 return new BoolConstant (bool_res);
866 case Binary.Operator.GreaterThan:
867 DoConstantNumericPromotions (oper, ref left, ref right, loc);
868 if (left == null || right == null)
872 if (left is DoubleConstant)
873 bool_res = ((DoubleConstant) left).Value >
874 ((DoubleConstant) right).Value;
875 else if (left is FloatConstant)
876 bool_res = ((FloatConstant) left).Value >
877 ((FloatConstant) right).Value;
878 else if (left is ULongConstant)
879 bool_res = ((ULongConstant) left).Value >
880 ((ULongConstant) right).Value;
881 else if (left is LongConstant)
882 bool_res = ((LongConstant) left).Value >
883 ((LongConstant) right).Value;
884 else if (left is UIntConstant)
885 bool_res = ((UIntConstant) left).Value >
886 ((UIntConstant) right).Value;
887 else if (left is IntConstant)
888 bool_res = ((IntConstant) left).Value >
889 ((IntConstant) right).Value;
893 return new BoolConstant (bool_res);
895 case Binary.Operator.GreaterThanOrEqual:
896 DoConstantNumericPromotions (oper, ref left, ref right, loc);
897 if (left == null || right == null)
901 if (left is DoubleConstant)
902 bool_res = ((DoubleConstant) left).Value >=
903 ((DoubleConstant) right).Value;
904 else if (left is FloatConstant)
905 bool_res = ((FloatConstant) left).Value >=
906 ((FloatConstant) right).Value;
907 else if (left is ULongConstant)
908 bool_res = ((ULongConstant) left).Value >=
909 ((ULongConstant) right).Value;
910 else if (left is LongConstant)
911 bool_res = ((LongConstant) left).Value >=
912 ((LongConstant) right).Value;
913 else if (left is UIntConstant)
914 bool_res = ((UIntConstant) left).Value >=
915 ((UIntConstant) right).Value;
916 else if (left is IntConstant)
917 bool_res = ((IntConstant) left).Value >=
918 ((IntConstant) right).Value;
922 return new BoolConstant (bool_res);
924 case Binary.Operator.LessThanOrEqual:
925 DoConstantNumericPromotions (oper, ref left, ref right, loc);
926 if (left == null || right == null)
930 if (left is DoubleConstant)
931 bool_res = ((DoubleConstant) left).Value <=
932 ((DoubleConstant) right).Value;
933 else if (left is FloatConstant)
934 bool_res = ((FloatConstant) left).Value <=
935 ((FloatConstant) right).Value;
936 else if (left is ULongConstant)
937 bool_res = ((ULongConstant) left).Value <=
938 ((ULongConstant) right).Value;
939 else if (left is LongConstant)
940 bool_res = ((LongConstant) left).Value <=
941 ((LongConstant) right).Value;
942 else if (left is UIntConstant)
943 bool_res = ((UIntConstant) left).Value <=
944 ((UIntConstant) right).Value;
945 else if (left is IntConstant)
946 bool_res = ((IntConstant) left).Value <=
947 ((IntConstant) right).Value;
951 return new BoolConstant (bool_res);