private static Int32 NumberOfTrailingZeros(long n) { Int32 mask = 1; Int32 result = 64; for (Int32 i = 0; i < 64; i++, mask <<= 1) { if ((n & mask) != 0) { result = i; break; } } return result; } #endregion