feat: Overload for Modulus taking long params

This commit is contained in:
Chris Cameron
2019-09-29 21:57:23 -04:00
committed by Chris Cameron
parent 52229c1472
commit 9e8cedfbfa
2 changed files with 15 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- IcdEnvironment.GetUtcTime() to get UTC representaiton of current time.
- Extension methods for determining if a sequence is in order
- Overload for calculating the modulus of longs
## [9.9.0] - 2019-09-16
### Added

View File

@@ -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;
}
}
}