mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-14 04:15:41 +00:00
Use bit check rather than modulo for IsEven
This commit is contained in:
parent
0bafb64ecb
commit
7a0aae3bd5
@ -66,7 +66,7 @@ namespace X10D
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public static bool IsEven(this short value)
|
public static bool IsEven(this short value)
|
||||||
{
|
{
|
||||||
return value % 2 == 0;
|
return (value & 1) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -66,7 +66,7 @@ namespace X10D
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public static bool IsEven(this int value)
|
public static bool IsEven(this int value)
|
||||||
{
|
{
|
||||||
return value % 2 == 0;
|
return (value & 1) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -66,7 +66,7 @@ namespace X10D
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public static bool IsEven(this long value)
|
public static bool IsEven(this long value)
|
||||||
{
|
{
|
||||||
return value % 2 == 0;
|
return (value & 1) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user