mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 05:05:05 +00:00
feat: Overload for Modulus taking long params
This commit is contained in:
committed by
Chris Cameron
parent
52229c1472
commit
9e8cedfbfa
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
### Added
|
### Added
|
||||||
- IcdEnvironment.GetUtcTime() to get UTC representaiton of current time.
|
- IcdEnvironment.GetUtcTime() to get UTC representaiton of current time.
|
||||||
- Extension methods for determining if a sequence is in order
|
- Extension methods for determining if a sequence is in order
|
||||||
|
- Overload for calculating the modulus of longs
|
||||||
|
|
||||||
## [9.9.0] - 2019-09-16
|
## [9.9.0] - 2019-09-16
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -216,11 +216,24 @@ namespace ICD.Common.Utils
|
|||||||
/// <param name="number"></param>
|
/// <param name="number"></param>
|
||||||
/// <param name="mod"></param>
|
/// <param name="mod"></param>
|
||||||
/// <returns></returns>
|
/// <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)
|
public static int Modulus(int number, int mod)
|
||||||
{
|
{
|
||||||
int remainder = number % mod;
|
int remainder = number % mod;
|
||||||
return remainder < 0 ? remainder + mod : remainder;
|
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