示例#1
0
        public static int ComputeRelativeSizeOf <TFirst, TSecond>()
        {
            var firstSize  = SizeOf <TFirst>();
            var secondSize = SizeOf <TSecond>();

            int count = 1;

            if (firstSize < secondSize)
            {
                count = IntrinsicMath.DivRoundUp(secondSize, firstSize);
            }
            return(count);
        }
示例#2
0
        public static int ComputeRelativeSizeOf <TFirst, TSecond>(int numSecondElements)
            where TFirst : unmanaged
            where TSecond : unmanaged
        {
            if (numSecondElements < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(numSecondElements));
            }

            var firstSize  = SizeOf <TFirst>();
            var secondSize = SizeOf <TSecond>();

            return(IntrinsicMath.DivRoundUp(secondSize * numSecondElements, firstSize));
        }