mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Fix NextMultipleOf for int/long (#2289)
This commit is contained in:
@@ -172,7 +172,7 @@ namespace Robust.Shared.Maths
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static long NextMultipleOf(long value, long of)
|
||||
{
|
||||
return ((value - 1) | (of - 1)) + 1;
|
||||
return ((value + of - 1) / of) * of;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -184,7 +184,7 @@ namespace Robust.Shared.Maths
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int NextMultipleOf(int value, int of)
|
||||
{
|
||||
return ((value - 1) | (of - 1)) + 1;
|
||||
return ((value + of - 1) / of) * of;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user