diff --git a/src/ImageProcessor/Common/Extensions/ComparableExtensions.cs b/src/ImageProcessor/Common/Extensions/ComparableExtensions.cs
index 3bf82c25f..36fa82d57 100644
--- a/src/ImageProcessor/Common/Extensions/ComparableExtensions.cs
+++ b/src/ImageProcessor/Common/Extensions/ComparableExtensions.cs
@@ -17,22 +17,6 @@ namespace ImageProcessor
///
internal static class ComparableExtensions
{
- ///
- /// Returns value indicating whether the given number is with in the minimum and maximum
- /// given range.
- ///
- /// The value to to check.
- /// The minimum range value.
- /// The maximum range value.
- /// The to test.
- ///
- /// True if the value falls within the maximum and minimum; otherwise, false.
- ///
- public static bool IsBetween(this T value, T min, T max) where T : IComparable
- {
- return (value.CompareTo(min) > 0) && (value.CompareTo(max) < 0);
- }
-
///
/// Restricts a value to be within a specified range.
///
@@ -43,7 +27,8 @@ namespace ImageProcessor
///
/// The representing the clamped value.
///
- public static T Clamp(this T value, T min, T max) where T : IComparable
+ public static T Clamp(this T value, T min, T max)
+ where T : IComparable
{
if (value.CompareTo(min) < 0)
{
diff --git a/src/ImageProcessor/Formats/Png/PngDecoderCore.cs b/src/ImageProcessor/Formats/Png/PngDecoderCore.cs
index 2036b4edf..f1fd83ead 100644
--- a/src/ImageProcessor/Formats/Png/PngDecoderCore.cs
+++ b/src/ImageProcessor/Formats/Png/PngDecoderCore.cs
@@ -449,7 +449,7 @@ namespace ImageProcessor.Formats
byte[] crcBuffer = new byte[4];
int numBytes = this.currentStream.Read(crcBuffer, 0, 4);
- if (numBytes.IsBetween(1, 3))
+ if (numBytes >= 1 && numBytes <= 3)
{
throw new ImageFormatException("Image stream is not valid!");
}
@@ -501,7 +501,7 @@ namespace ImageProcessor.Formats
byte[] typeBuffer = new byte[4];
int numBytes = this.currentStream.Read(typeBuffer, 0, 4);
- if (numBytes.IsBetween(1, 3))
+ if (numBytes >= 1 && numBytes <= 3)
{
throw new ImageFormatException("Image stream is not valid!");
}
@@ -532,7 +532,7 @@ namespace ImageProcessor.Formats
byte[] lengthBuffer = new byte[4];
int numBytes = this.currentStream.Read(lengthBuffer, 0, 4);
- if (numBytes.IsBetween(1, 3))
+ if (numBytes >= 1 && numBytes <= 3)
{
throw new ImageFormatException("Image stream is not valid!");
}