1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-23 00:38:47 +00:00

Use bit check rather than modulo for IsEven

This commit is contained in:
Oliver Booth 2021-08-31 15:49:43 +01:00
parent 0bafb64ecb
commit 7a0aae3bd5
No known key found for this signature in database
GPG Key ID: A4AC17007530E9B4
3 changed files with 3 additions and 3 deletions

View File

@ -66,7 +66,7 @@ namespace X10D
/// </returns>
public static bool IsEven(this short value)
{
return value % 2 == 0;
return (value & 1) == 0;
}
/// <summary>

View File

@ -66,7 +66,7 @@ namespace X10D
/// </returns>
public static bool IsEven(this int value)
{
return value % 2 == 0;
return (value & 1) == 0;
}
/// <summary>

View File

@ -66,7 +66,7 @@ namespace X10D
/// </returns>
public static bool IsEven(this long value)
{
return value % 2 == 0;
return (value & 1) == 0;
}
/// <summary>