예제 #1
0
        /// <summary>
        /// Performs a linear search for a consecutive sequence of 0s of a given length in the bit array.
        /// </summary>
        /// <param name="pos">Position to start search in bit array.</param>
        /// <param name="numBits">Number of 0-bits to find.</param>
        /// <returns>Returns index of first bit of 0-bit range, or int.MaxValue if 0-bit range is not found.</returns>
        /// <exception cref="ArgumentException">
        /// Thrown if:
        ///  - Number of bits is less than 1.
        ///  - Range searched has less than `numBits`.
        ///  - `pos` is not within accepted range [0 - Length].
        /// </exception>
        public int Find(int pos, int numBits)
        {
            var count = Length - pos;

            CheckArgsPosCount(pos, count, numBits);
            return(Bitwise.Find(Ptr, pos, count, numBits));
        }
예제 #2
0
 /// <summary>
 /// Performs a linear search for a consecutive sequence of 0s of a given length in the bit array.
 /// </summary>
 /// <param name="pos">Position to start search in bit array.</param>
 /// <param name="count">Number of bits to search.</param>
 /// <param name="numBits">Number of 0-bits to find.</param>
 /// <returns>Returns index of first bit of 0-bit range, or int.MaxValue if 0-bit range is not found.</returns>
 /// <exception cref="ArgumentException">
 /// Thrown if:
 ///  - Number of bits is less than 1.
 ///  - Range searched has less than `numBits`.
 ///  - `pos` or `count` are not within accepted range [0 - Length].
 /// </exception>
 public int Find(int pos, int count, int numBits)
 {
     CheckArgsPosCount(pos, count, numBits);
     return(Bitwise.Find(Ptr, pos, count, numBits));
 }