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); }
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)); }