Several hints removed & code cleaned up.
This commit is contained in:
1 parent
b038bcfdc9
commit
52dc663ada
26 files changed
+107
-139
No files matched your search
@@ -5,13 +5,13 @@ namespace Recyclable.Collections
|
||||
{
|
||||
public static class MathUtils
|
||||
{
|
||||
private static readonly long[] Pow2 = new long[]
|
||||
{
|
||||
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384,
|
||||
32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304,
|
||||
8388608, 16777216, 33554432, 67108864, 134217728, 268435456,
|
||||
536870912, 1073741824, 2147483648
|
||||
};
|
||||
// private static readonly long[] Pow2 = new long[]
|
||||
// {
|
||||
// 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384,
|
||||
// 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304,
|
||||
// 8388608, 16777216, 33554432, 67108864, 134217728, 268435456,
|
||||
// 536870912, 1073741824, 2147483648
|
||||
// };
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsPow2(long value) => (value != 0) && ((value & (value - 1)) == 0);
|
||||
|
||||
Reference in new issue
Block a user