From 10e4b02a3b9432f940a6f51b8bba7f67d0939f39 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Fri, 26 Jan 2007 18:45:19 +0000 Subject: [PATCH] 2007-01-26 Miguel de Icaza * constant.cs: Removed a handful of out-of-range checks that were not necessary. svn path=/trunk/mcs/; revision=71763 --- mcs/mcs/ChangeLog | 5 +++++ mcs/mcs/constant.cs | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog index fc775072e24..c30f714dd29 100644 --- a/mcs/mcs/ChangeLog +++ b/mcs/mcs/ChangeLog @@ -1,3 +1,8 @@ +2007-01-26 Miguel de Icaza + + * constant.cs: Removed a handful of out-of-range checks that were + not necessary. + 2007-01-25 Marek Safar * expression.cs (CheckUselessComparison): Add additional check for char diff --git a/mcs/mcs/constant.cs b/mcs/mcs/constant.cs index 9ceef13ac9a..0b11bcadadf 100644 --- a/mcs/mcs/constant.cs +++ b/mcs/mcs/constant.cs @@ -466,14 +466,14 @@ namespace Mono.CSharp { } if (target_type == TypeManager.sbyte_type) { if (inCheckedContext){ - if (Value < SByte.MinValue || Value > SByte.MaxValue) + if (Value > SByte.MaxValue) throw new OverflowException (); } return new SByteConstant ((sbyte) Value, Location); } if (target_type == TypeManager.short_type) { if (inCheckedContext){ - if (Value < Int16.MinValue || Value > Int16.MaxValue) + if (Value > Int16.MaxValue) throw new OverflowException (); } return new ShortConstant ((short) Value, Location); @@ -677,7 +677,7 @@ namespace Mono.CSharp { return new DoubleConstant ((double) Value, Location); if (target_type == TypeManager.char_type) { if (inCheckedContext){ - if (Value < Char.MinValue && Value > Char.MaxValue) + if (Value < Char.MinValue) throw new OverflowException (); } return new CharConstant ((char) Value, Location); -- 2.25.1