GitSharp.Core.Util.Int32Extensions.NumberOfTrailingZeros C# (CSharp) Method

NumberOfTrailingZeros() public static method

computes the number of 0 bits to the right of the first 1
public static NumberOfTrailingZeros ( this n ) : int
n this
return int
        public static int NumberOfTrailingZeros(this int n)
        {
            Debug.Assert(n != 0);
            uint i = (uint)n;
            int zeros = 0;
            while ((i & 1) == 0)
            {
                zeros++;
                i >>= 1;
            }
            return zeros;
        }