Source/NFX/IntMath.cs
/// <summary>
/// Gets the capacity of at least or larger larger than the specified number. For numbers &lt;= 16300007 the function uses lookup table for speed
/// </summary>
Gets the capacity of at least or larger larger than the specified number. For numbers <= 16300007 the function uses lookup table for speed
Gets the capacity of at least or larger larger than the specified number . For numbers < = 16300007 the function uses lookup table for speed
public static int GetPrimeCapacityOfAtLeast(int capacity)
        {
          if (capacity<=0)
            throw new NFXException(StringConsts.ARGUMENT_ERROR+"GetPrimeCapacityOfAtLeast(capacity<=0)");
          for (var i=0; i < PRIME_CAPACITIES.Length; i++)
          {
             int prime = PRIME_CAPACITIES[i];
             if (prime >= capacity) return prime;
          }
          for (var i=capacity|1; i < int.MaxValue; i+=2)
          {
             if (IsPrime(i)) return i;
          }
          return capacity;
        }
public static int GetPrimeCapacityOfAtLeast ( int capacity ) { if ( capacity <= 0 ) throw new NFXException ( StringConsts . ARGUMENT_ERROR + " " ) ; for ( var i = 0 ; i < PRIME_CAPACITIES . Length ; i ++ ) { int prime = PRIME_CAPACITIES [ i ] ; if ( prime >= capacity ) return prime ; } for ( var i = capacity | 1 ; i < int . MaxValue ; i += 2 ) { if ( IsPrime ( i ) ) return i ; } return capacity ; }
Gets the capacity of at least or larger larger than the specified number.
Gets the capacity of at least or larger larger than the specified number .
capacity
int