예제 #1
0
        static int ValidateAndCalculateChunkSize(int pageSize, int maxOrder)
        {
            if (maxOrder > 14)
            {
                ThrowHelper.ThrowArgumentException_CheckMaxOrder14(maxOrder);
            }

            // Ensure the resulting chunkSize does not overflow.
            int chunkSize = pageSize;

            for (int i = maxOrder; i > 0; i--)
            {
                if (chunkSize > MaxChunkSize >> 1)
                {
                    ThrowHelper.ThrowArgumentException_PageSize(pageSize, maxOrder, MaxChunkSize);
                }
                chunkSize <<= 1;
            }
            return(chunkSize);
        }