mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-14 12:15:05 +00:00
feat: Overload for Modulus taking long params
This commit is contained in:
committed by
Chris Cameron
parent
52229c1472
commit
9e8cedfbfa
@@ -216,11 +216,24 @@ namespace ICD.Common.Utils
|
||||
/// <param name="number"></param>
|
||||
/// <param name="mod"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>method name can't be "Mod", due to S+ compatability issues</remarks>
|
||||
/// <remarks>Method name can't be "Mod", due to S+ compatibility issues</remarks>
|
||||
public static int Modulus(int number, int mod)
|
||||
{
|
||||
int remainder = number % mod;
|
||||
return remainder < 0 ? remainder + mod : remainder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the modulus of the given number.
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <param name="mod"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>Method name can't be "Mod", due to S+ compatibility issues</remarks>
|
||||
public static long Modulus(long number, long mod)
|
||||
{
|
||||
long remainder = number % mod;
|
||||
return remainder < 0 ? remainder + mod : remainder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user