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 (loc);
41 if (!(right is DoubleConstant))
42 right = right.ToDouble (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 (loc);
51 if (!(right is FloatConstant))
52 right = right.ToFloat (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 (loc);
70 left = left.ToULong (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 (loc);
88 else if (!(right is LongConstant))
89 right = right.ToLong (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 (loc);
99 else if (!(right is UIntConstant))
100 right = right.ToUInt (loc);
104 // Force conversions to int32
106 if (!(left is IntConstant))
107 left = left.ToInt (loc);
108 if (!(right is IntConstant))
109 right = right.ToInt (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 bool left_is_string = left is StringConstant;
276 bool right_is_string = right is StringConstant;
279 // If both sides are strings, then concatenate, if
280 // one is a string, and the other is not, then defer
281 // to runtime concatenation
283 if (left_is_string || right_is_string){
284 if (left_is_string && right_is_string)
285 return new StringConstant (
286 ((StringConstant) left).Value +
287 ((StringConstant) right).Value);
292 DoConstantNumericPromotions (oper, ref left, ref right, loc);
293 if (left == null || right == null)
297 if (left is DoubleConstant){
300 if (ec.ConstantCheckState)
301 res = checked (((DoubleConstant) left).Value +
302 ((DoubleConstant) right).Value);
304 res = unchecked (((DoubleConstant) left).Value +
305 ((DoubleConstant) right).Value);
307 return new DoubleConstant (res);
308 } else if (left is FloatConstant){
311 if (ec.ConstantCheckState)
312 res = checked (((FloatConstant) left).Value +
313 ((FloatConstant) right).Value);
315 res = unchecked (((FloatConstant) left).Value +
316 ((FloatConstant) right).Value);
318 return new FloatConstant (res);
319 } else if (left is ULongConstant){
322 if (ec.ConstantCheckState)
323 res = checked (((ULongConstant) left).Value +
324 ((ULongConstant) right).Value);
326 res = unchecked (((ULongConstant) left).Value +
327 ((ULongConstant) right).Value);
329 return new ULongConstant (res);
330 } else if (left is LongConstant){
333 if (ec.ConstantCheckState)
334 res = checked (((LongConstant) left).Value +
335 ((LongConstant) right).Value);
337 res = unchecked (((LongConstant) left).Value +
338 ((LongConstant) right).Value);
340 return new LongConstant (res);
341 } else if (left is UIntConstant){
344 if (ec.ConstantCheckState)
345 res = checked (((UIntConstant) left).Value +
346 ((UIntConstant) right).Value);
348 res = unchecked (((UIntConstant) left).Value +
349 ((UIntConstant) right).Value);
351 return new UIntConstant (res);
352 } else if (left is IntConstant){
355 if (ec.ConstantCheckState)
356 res = checked (((IntConstant) left).Value +
357 ((IntConstant) right).Value);
359 res = unchecked (((IntConstant) left).Value +
360 ((IntConstant) right).Value);
362 return new IntConstant (res);
364 throw new Exception ( "Unexepected input: " + left);
366 } catch (OverflowException){
367 Error_CompileTimeOverflow (loc);
371 case Binary.Operator.Subtraction:
372 DoConstantNumericPromotions (oper, ref left, ref right, loc);
373 if (left == null || right == null)
377 if (left is DoubleConstant){
380 if (ec.ConstantCheckState)
381 res = checked (((DoubleConstant) left).Value -
382 ((DoubleConstant) right).Value);
384 res = unchecked (((DoubleConstant) left).Value -
385 ((DoubleConstant) right).Value);
387 return new DoubleConstant (res);
388 } else if (left is FloatConstant){
391 if (ec.ConstantCheckState)
392 res = checked (((FloatConstant) left).Value -
393 ((FloatConstant) right).Value);
395 res = unchecked (((FloatConstant) left).Value -
396 ((FloatConstant) right).Value);
398 return new FloatConstant (res);
399 } else if (left is ULongConstant){
402 if (ec.ConstantCheckState)
403 res = checked (((ULongConstant) left).Value -
404 ((ULongConstant) right).Value);
406 res = unchecked (((ULongConstant) left).Value -
407 ((ULongConstant) right).Value);
409 return new ULongConstant (res);
410 } else if (left is LongConstant){
413 if (ec.ConstantCheckState)
414 res = checked (((LongConstant) left).Value -
415 ((LongConstant) right).Value);
417 res = unchecked (((LongConstant) left).Value -
418 ((LongConstant) right).Value);
420 return new LongConstant (res);
421 } else if (left is UIntConstant){
424 if (ec.ConstantCheckState)
425 res = checked (((UIntConstant) left).Value -
426 ((UIntConstant) right).Value);
428 res = unchecked (((UIntConstant) left).Value -
429 ((UIntConstant) right).Value);
431 return new UIntConstant (res);
432 } else if (left is IntConstant){
435 if (ec.ConstantCheckState)
436 res = checked (((IntConstant) left).Value -
437 ((IntConstant) right).Value);
439 res = unchecked (((IntConstant) left).Value -
440 ((IntConstant) right).Value);
442 return new IntConstant (res);
444 throw new Exception ( "Unexepected input: " + left);
446 } catch (OverflowException){
447 Error_CompileTimeOverflow (loc);
451 case Binary.Operator.Multiply:
452 DoConstantNumericPromotions (oper, ref left, ref right, loc);
453 if (left == null || right == null)
457 if (left is DoubleConstant){
460 if (ec.ConstantCheckState)
461 res = checked (((DoubleConstant) left).Value *
462 ((DoubleConstant) right).Value);
464 res = unchecked (((DoubleConstant) left).Value *
465 ((DoubleConstant) right).Value);
467 return new DoubleConstant (res);
468 } else if (left is FloatConstant){
471 if (ec.ConstantCheckState)
472 res = checked (((FloatConstant) left).Value *
473 ((FloatConstant) right).Value);
475 res = unchecked (((FloatConstant) left).Value *
476 ((FloatConstant) right).Value);
478 return new FloatConstant (res);
479 } else if (left is ULongConstant){
482 if (ec.ConstantCheckState)
483 res = checked (((ULongConstant) left).Value *
484 ((ULongConstant) right).Value);
486 res = unchecked (((ULongConstant) left).Value *
487 ((ULongConstant) right).Value);
489 return new ULongConstant (res);
490 } else if (left is LongConstant){
493 if (ec.ConstantCheckState)
494 res = checked (((LongConstant) left).Value *
495 ((LongConstant) right).Value);
497 res = unchecked (((LongConstant) left).Value *
498 ((LongConstant) right).Value);
500 return new LongConstant (res);
501 } else if (left is UIntConstant){
504 if (ec.ConstantCheckState)
505 res = checked (((UIntConstant) left).Value *
506 ((UIntConstant) right).Value);
508 res = unchecked (((UIntConstant) left).Value *
509 ((UIntConstant) right).Value);
511 return new UIntConstant (res);
512 } else if (left is IntConstant){
515 if (ec.ConstantCheckState)
516 res = checked (((IntConstant) left).Value *
517 ((IntConstant) right).Value);
519 res = unchecked (((IntConstant) left).Value *
520 ((IntConstant) right).Value);
522 return new IntConstant (res);
524 throw new Exception ( "Unexepected input: " + left);
526 } catch (OverflowException){
527 Error_CompileTimeOverflow (loc);
531 case Binary.Operator.Division:
532 DoConstantNumericPromotions (oper, ref left, ref right, loc);
533 if (left == null || right == null)
537 if (left is DoubleConstant){
540 if (ec.ConstantCheckState)
541 res = checked (((DoubleConstant) left).Value /
542 ((DoubleConstant) right).Value);
544 res = unchecked (((DoubleConstant) left).Value /
545 ((DoubleConstant) right).Value);
547 return new DoubleConstant (res);
548 } else if (left is FloatConstant){
551 if (ec.ConstantCheckState)
552 res = checked (((FloatConstant) left).Value /
553 ((FloatConstant) right).Value);
555 res = unchecked (((FloatConstant) left).Value /
556 ((FloatConstant) right).Value);
558 return new FloatConstant (res);
559 } else if (left is ULongConstant){
562 if (ec.ConstantCheckState)
563 res = checked (((ULongConstant) left).Value /
564 ((ULongConstant) right).Value);
566 res = unchecked (((ULongConstant) left).Value /
567 ((ULongConstant) right).Value);
569 return new ULongConstant (res);
570 } else if (left is LongConstant){
573 if (ec.ConstantCheckState)
574 res = checked (((LongConstant) left).Value /
575 ((LongConstant) right).Value);
577 res = unchecked (((LongConstant) left).Value /
578 ((LongConstant) right).Value);
580 return new LongConstant (res);
581 } else if (left is UIntConstant){
584 if (ec.ConstantCheckState)
585 res = checked (((UIntConstant) left).Value /
586 ((UIntConstant) right).Value);
588 res = unchecked (((UIntConstant) left).Value /
589 ((UIntConstant) right).Value);
591 return new UIntConstant (res);
592 } else if (left is IntConstant){
595 if (ec.ConstantCheckState)
596 res = checked (((IntConstant) left).Value /
597 ((IntConstant) right).Value);
599 res = unchecked (((IntConstant) left).Value /
600 ((IntConstant) right).Value);
602 return new IntConstant (res);
604 throw new Exception ( "Unexepected input: " + left);
606 } catch (OverflowException){
607 Error_CompileTimeOverflow (loc);
611 case Binary.Operator.Modulus:
612 DoConstantNumericPromotions (oper, ref left, ref right, loc);
613 if (left == null || right == null)
617 if (left is DoubleConstant){
620 if (ec.ConstantCheckState)
621 res = checked (((DoubleConstant) left).Value %
622 ((DoubleConstant) right).Value);
624 res = unchecked (((DoubleConstant) left).Value %
625 ((DoubleConstant) right).Value);
627 return new DoubleConstant (res);
628 } else if (left is FloatConstant){
631 if (ec.ConstantCheckState)
632 res = checked (((FloatConstant) left).Value %
633 ((FloatConstant) right).Value);
635 res = unchecked (((FloatConstant) left).Value %
636 ((FloatConstant) right).Value);
638 return new FloatConstant (res);
639 } else if (left is ULongConstant){
642 if (ec.ConstantCheckState)
643 res = checked (((ULongConstant) left).Value %
644 ((ULongConstant) right).Value);
646 res = unchecked (((ULongConstant) left).Value %
647 ((ULongConstant) right).Value);
649 return new ULongConstant (res);
650 } else if (left is LongConstant){
653 if (ec.ConstantCheckState)
654 res = checked (((LongConstant) left).Value %
655 ((LongConstant) right).Value);
657 res = unchecked (((LongConstant) left).Value %
658 ((LongConstant) right).Value);
660 return new LongConstant (res);
661 } else if (left is UIntConstant){
664 if (ec.ConstantCheckState)
665 res = checked (((UIntConstant) left).Value %
666 ((UIntConstant) right).Value);
668 res = unchecked (((UIntConstant) left).Value %
669 ((UIntConstant) right).Value);
671 return new UIntConstant (res);
672 } else if (left is IntConstant){
675 if (ec.ConstantCheckState)
676 res = checked (((IntConstant) left).Value %
677 ((IntConstant) right).Value);
679 res = unchecked (((IntConstant) left).Value %
680 ((IntConstant) right).Value);
682 return new IntConstant (res);
684 throw new Exception ( "Unexepected input: " + left);
686 } catch (OverflowException){
687 Error_CompileTimeOverflow (loc);
692 // There is no overflow checking on left shift
694 case Binary.Operator.LeftShift:
695 IntConstant ic = right.ToInt (loc);
697 Binary.Error_OperatorCannotBeApplied (loc, "<<", lt, rt);
700 int lshift_val = ic.Value;
703 if ((lic = left.ConvertToInt ()) != null)
704 return new IntConstant (lic.Value << lshift_val);
707 if ((luic = left.ConvertToUInt ()) != null)
708 return new UIntConstant (luic.Value << lshift_val);
711 if ((llc = left.ConvertToLong ()) != null)
712 return new LongConstant (llc.Value << lshift_val);
715 if ((lulc = left.ConvertToULong ()) != null)
716 return new ULongConstant (lulc.Value << lshift_val);
718 Binary.Error_OperatorCannotBeApplied (loc, "<<", lt, rt);
722 // There is no overflow checking on right shift
724 case Binary.Operator.RightShift:
725 IntConstant sic = right.ToInt (loc);
727 Binary.Error_OperatorCannotBeApplied (loc, ">>", lt, rt);
730 int rshift_val = sic.Value;
733 if ((ric = left.ConvertToInt ()) != null)
734 return new IntConstant (ric.Value >> rshift_val);
737 if ((ruic = left.ConvertToUInt ()) != null)
738 return new UIntConstant (ruic.Value >> rshift_val);
741 if ((rlc = left.ConvertToLong ()) != null)
742 return new LongConstant (rlc.Value >> rshift_val);
745 if ((rulc = left.ConvertToULong ()) != null)
746 return new ULongConstant (rulc.Value >> rshift_val);
748 Binary.Error_OperatorCannotBeApplied (loc, ">>", lt, rt);
751 case Binary.Operator.LogicalAnd:
752 if (left is BoolConstant && right is BoolConstant){
753 return new BoolConstant (
754 ((BoolConstant) left).Value &&
755 ((BoolConstant) right).Value);
759 case Binary.Operator.LogicalOr:
760 if (left is BoolConstant && right is BoolConstant){
761 return new BoolConstant (
762 ((BoolConstant) left).Value ||
763 ((BoolConstant) right).Value);
767 case Binary.Operator.Equality:
768 if (left is BoolConstant && right is BoolConstant){
769 return new BoolConstant (
770 ((BoolConstant) left).Value ==
771 ((BoolConstant) right).Value);
774 if (left is StringConstant && right is StringConstant){
775 return new BoolConstant (
776 ((StringConstant) left).Value ==
777 ((StringConstant) right).Value);
781 DoConstantNumericPromotions (oper, ref left, ref right, loc);
782 if (left == null || right == null)
786 if (left is DoubleConstant)
787 bool_res = ((DoubleConstant) left).Value ==
788 ((DoubleConstant) right).Value;
789 else if (left is FloatConstant)
790 bool_res = ((FloatConstant) left).Value ==
791 ((FloatConstant) right).Value;
792 else if (left is ULongConstant)
793 bool_res = ((ULongConstant) left).Value ==
794 ((ULongConstant) right).Value;
795 else if (left is LongConstant)
796 bool_res = ((LongConstant) left).Value ==
797 ((LongConstant) right).Value;
798 else if (left is UIntConstant)
799 bool_res = ((UIntConstant) left).Value ==
800 ((UIntConstant) right).Value;
801 else if (left is IntConstant)
802 bool_res = ((IntConstant) left).Value ==
803 ((IntConstant) right).Value;
807 return new BoolConstant (bool_res);
809 case Binary.Operator.Inequality:
810 if (left is BoolConstant && right is BoolConstant){
811 return new BoolConstant (
812 ((BoolConstant) left).Value !=
813 ((BoolConstant) right).Value);
815 if (left is StringConstant && right is StringConstant){
816 return new BoolConstant (
817 ((StringConstant) left).Value !=
818 ((StringConstant) right).Value);
821 DoConstantNumericPromotions (oper, ref left, ref right, loc);
822 if (left == null || right == null)
826 if (left is DoubleConstant)
827 bool_res = ((DoubleConstant) left).Value !=
828 ((DoubleConstant) right).Value;
829 else if (left is FloatConstant)
830 bool_res = ((FloatConstant) left).Value !=
831 ((FloatConstant) right).Value;
832 else if (left is ULongConstant)
833 bool_res = ((ULongConstant) left).Value !=
834 ((ULongConstant) right).Value;
835 else if (left is LongConstant)
836 bool_res = ((LongConstant) left).Value !=
837 ((LongConstant) right).Value;
838 else if (left is UIntConstant)
839 bool_res = ((UIntConstant) left).Value !=
840 ((UIntConstant) right).Value;
841 else if (left is IntConstant)
842 bool_res = ((IntConstant) left).Value !=
843 ((IntConstant) right).Value;
847 return new BoolConstant (bool_res);
849 case Binary.Operator.LessThan:
850 DoConstantNumericPromotions (oper, ref left, ref right, loc);
851 if (left == null || right == null)
855 if (left is DoubleConstant)
856 bool_res = ((DoubleConstant) left).Value <
857 ((DoubleConstant) right).Value;
858 else if (left is FloatConstant)
859 bool_res = ((FloatConstant) left).Value <
860 ((FloatConstant) right).Value;
861 else if (left is ULongConstant)
862 bool_res = ((ULongConstant) left).Value <
863 ((ULongConstant) right).Value;
864 else if (left is LongConstant)
865 bool_res = ((LongConstant) left).Value <
866 ((LongConstant) right).Value;
867 else if (left is UIntConstant)
868 bool_res = ((UIntConstant) left).Value <
869 ((UIntConstant) right).Value;
870 else if (left is IntConstant)
871 bool_res = ((IntConstant) left).Value <
872 ((IntConstant) right).Value;
876 return new BoolConstant (bool_res);
878 case Binary.Operator.GreaterThan:
879 DoConstantNumericPromotions (oper, ref left, ref right, loc);
880 if (left == null || right == null)
884 if (left is DoubleConstant)
885 bool_res = ((DoubleConstant) left).Value >
886 ((DoubleConstant) right).Value;
887 else if (left is FloatConstant)
888 bool_res = ((FloatConstant) left).Value >
889 ((FloatConstant) right).Value;
890 else if (left is ULongConstant)
891 bool_res = ((ULongConstant) left).Value >
892 ((ULongConstant) right).Value;
893 else if (left is LongConstant)
894 bool_res = ((LongConstant) left).Value >
895 ((LongConstant) right).Value;
896 else if (left is UIntConstant)
897 bool_res = ((UIntConstant) left).Value >
898 ((UIntConstant) right).Value;
899 else if (left is IntConstant)
900 bool_res = ((IntConstant) left).Value >
901 ((IntConstant) right).Value;
905 return new BoolConstant (bool_res);
907 case Binary.Operator.GreaterThanOrEqual:
908 DoConstantNumericPromotions (oper, ref left, ref right, loc);
909 if (left == null || right == null)
913 if (left is DoubleConstant)
914 bool_res = ((DoubleConstant) left).Value >=
915 ((DoubleConstant) right).Value;
916 else if (left is FloatConstant)
917 bool_res = ((FloatConstant) left).Value >=
918 ((FloatConstant) right).Value;
919 else if (left is ULongConstant)
920 bool_res = ((ULongConstant) left).Value >=
921 ((ULongConstant) right).Value;
922 else if (left is LongConstant)
923 bool_res = ((LongConstant) left).Value >=
924 ((LongConstant) right).Value;
925 else if (left is UIntConstant)
926 bool_res = ((UIntConstant) left).Value >=
927 ((UIntConstant) right).Value;
928 else if (left is IntConstant)
929 bool_res = ((IntConstant) left).Value >=
930 ((IntConstant) right).Value;
934 return new BoolConstant (bool_res);
936 case Binary.Operator.LessThanOrEqual:
937 DoConstantNumericPromotions (oper, ref left, ref right, loc);
938 if (left == null || right == null)
942 if (left is DoubleConstant)
943 bool_res = ((DoubleConstant) left).Value <=
944 ((DoubleConstant) right).Value;
945 else if (left is FloatConstant)
946 bool_res = ((FloatConstant) left).Value <=
947 ((FloatConstant) right).Value;
948 else if (left is ULongConstant)
949 bool_res = ((ULongConstant) left).Value <=
950 ((ULongConstant) right).Value;
951 else if (left is LongConstant)
952 bool_res = ((LongConstant) left).Value <=
953 ((LongConstant) right).Value;
954 else if (left is UIntConstant)
955 bool_res = ((UIntConstant) left).Value <=
956 ((UIntConstant) right).Value;
957 else if (left is IntConstant)
958 bool_res = ((IntConstant) left).Value <=
959 ((IntConstant) right).Value;
963 return new BoolConstant (bool_res);