﻿namespace elbsms_core
{
    internal static class Extensions
    {
        internal static bool Bit(this byte v, int bit)
        {
            int mask = 1 << bit;

            return (v & mask) == mask;
        }

        internal static bool Bit(this int v, int bit)
        {
            int mask = 1 << bit;

            return (v & mask) == mask;
        }

        internal static bool EvenParity(this int v)
        {
            v ^= v >> 4;
            v ^= v >> 2;
            v ^= v >> 1;

            return (v & 1) != 1;
        }
    }
}

﻿namespace elbsms_core
{
    internal static class Extensions
    {
        internal static bool Bit(this byte v, int bit)
        {
            int mask = 1 << bit;

            return (v & mask) != 0;
        }

        internal static bool Bit(this int v, int bit)
        {
            int mask = 1 << bit;

            return (v & mask) != 0;
        }

        internal static bool EvenParity(this int v)
        {
            v ^= v >> 4;
            v ^= v >> 2;
            v ^= v >> 1;

            return (v & 1) != 1;
        }
    }
}

Update the mask check in the Bit() extension method
Update the mask check in the Bit() extension method

Apparently comparing against zero helps the JIT produce slightly more efficient code, based on research in this article https://www.tabsoverspaces.com/233785-is-it-better-to-not-equals-0-or-equals-mask-when-working-with-enums-csharp-ryujit
