public static ulong CreateBitMask(int bitCount) { if (bitCount == 0) return 0; return ulong.MaxValue >> (64 - bitCount); }