Esempio n. 1
0
 public static OrderablePartitioner <Tuple <int, int> > Create(int fromInclusive, int toExclusive, int rangeSize)
 {
     if (toExclusive <= fromInclusive)
     {
         throw new ArgumentOutOfRangeException("toExclusive");
     }
     if (rangeSize <= 0)
     {
         throw new ArgumentOutOfRangeException("rangeSize");
     }
     return(Partitioner.Create <Tuple <int, int> >(Partitioner.CreateRanges(fromInclusive, toExclusive, rangeSize), EnumerablePartitionerOptions.NoBuffering));
 }
Esempio n. 2
0
        public static OrderablePartitioner <Tuple <long, long> > Create(long fromInclusive, long toExclusive)
        {
            int num = 3;

            if (toExclusive <= fromInclusive)
            {
                throw new ArgumentOutOfRangeException("toExclusive");
            }
            long rangeSize = (toExclusive - fromInclusive) / (long)(PlatformHelper.ProcessorCount * num);

            if (rangeSize == 0L)
            {
                rangeSize = 1L;
            }
            return(Partitioner.Create <Tuple <long, long> >(Partitioner.CreateRanges(fromInclusive, toExclusive, rangeSize), EnumerablePartitionerOptions.NoBuffering));
        }