From 5ee8785edeb942c92e9f4f66007ed22bebda4fc1 Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Tue, 28 Jun 2022 10:39:12 +0200 Subject: [PATCH] Fix missing `IsZero` and `IsOne` for `int32` --- Source/Engine/Core/Math/Math.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/Engine/Core/Math/Math.h b/Source/Engine/Core/Math/Math.h index 40a1fa835..46e85247f 100644 --- a/Source/Engine/Core/Math/Math.h +++ b/Source/Engine/Core/Math/Math.h @@ -435,6 +435,14 @@ namespace Math return amount <= 0 ? 0 : amount >= 1 ? 1 : amount * amount * amount * (amount * (amount * 6 - 15) + 10); } + // Determines whether the specified value is close to zero (0.0) + // @param a The integer value + // @returns True if the specified value is close to zero (0.0). otherwise false + inline int32 IsZero(int32 a) + { + return a == 0; + } + // Determines whether the specified value is close to zero (0.0f) // @param a The floating value // @returns True if the specified value is close to zero (0.0f). otherwise false @@ -443,6 +451,14 @@ namespace Math return Abs(a) < ZeroTolerance; } + // Determines whether the specified value is close to one (1.0) + // @param a The integer value + // @returns True if the specified value is close to one (1.0). otherwise false + inline bool IsOne(int32 a) + { + return a == 1; + } + // Determines whether the specified value is close to one (1.0f) // @param a The floating value // @returns True if the specified value is close to one (1.0f). otherwise false