Improve math helper for next multiple.

This commit is contained in:
Víctor Aguilera Puerto
2020-11-02 18:14:09 +01:00
parent 6299302025
commit 96b5779078
+2 -2
View File
@@ -172,7 +172,7 @@ namespace Robust.Shared.Maths
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static long NextMultipleOf(long value, long of)
{
return (long)NextMultipleOf((double)value, of);
return ((value - 1) | (of - 1)) + 1;
}
/// <summary>
@@ -184,7 +184,7 @@ namespace Robust.Shared.Maths
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int NextMultipleOf(int value, int of)
{
return (int)NextMultipleOf((float)value, of);
return ((value - 1) | (of - 1)) + 1;
}
#endregion