Pchp.Library.Arrays.RangeOfLongInts C# (CSharp) Method

RangeOfLongInts() private static method

Creates an array containing range of long integers from the [low;high] interval with arbitrary step.
private static RangeOfLongInts ( long low, long high, long step ) : PhpArray
low long Lower bound of the interval.
high long Upper bound of the interval.
step long The step. An absolute value is taken if step is zero.
return Pchp.Core.PhpArray
        private static PhpArray RangeOfLongInts(long low, long high, long step)
        {
            if (step == 0)
            {
                //PhpException.InvalidArgument("step", LibResources.GetString("arg:zero"));
                //return null;
                throw new ArgumentException();
            }

            if (step < 0) step = -step;

            PhpArray result = new PhpArray(unchecked((int)(Math.Abs(high - low) / step + 1)));

            if (high >= low)
            {
                for (int i = 0; low <= high; i++, low += step) result.Add(i, low);
            }
            else
            {
                for (int i = 0; low >= high; i++, low -= step) result.Add(i, low);
            }

            return result;
        }