From 1dc8f3d272b2b46e2778d9439a5f8605ab3092ff Mon Sep 17 00:00:00 2001 From: Syntriax Date: Thu, 1 Feb 2024 13:01:35 +0300 Subject: [PATCH] refactor: Math.AbsMax & AbsMin to Single Liners --- Engine.Core/Math.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Engine.Core/Math.cs b/Engine.Core/Math.cs index cb7f4b8..199a661 100644 --- a/Engine.Core/Math.cs +++ b/Engine.Core/Math.cs @@ -129,13 +129,7 @@ public static class Math /// The first number. /// The second number. /// The number whose absolute value is larger. - public static T AbsMax(T x, T y) where T : INumber - { - T xAbs = Abs(x); - T yAbs = Abs(y); - - return (xAbs > yAbs) ? x : y; - } + public static T AbsMax(T x, T y) where T : INumber => (Abs(x) > Abs(y)) ? x : y; /// /// Returns the smaller of two numbers. @@ -152,13 +146,7 @@ public static class Math /// The first number. /// The second number. /// The number whose absolute value is smaller. - public static T AbsMin(T x, T y) where T : INumber - { - T xAbs = Abs(x); - T yAbs = Abs(y); - - return (xAbs < yAbs) ? x : y; - } + public static T AbsMin(T x, T y) where T : INumber => (Abs(x) < Abs(y)) ? x : y; /// /// Returns a specified number raised to the specified power.