/// <summary> /// Multiply two object[] arrays - internal version used for objects backed by arrays /// </summary> internal static object[] Multiply(object[] data, int size, int count) { int newCount; try { newCount = checked (size * count); } catch (OverflowException) { throw PythonOps.MemoryError(); } object[] ret = ArrayOps.CopyArray(data, newCount); if (count > 0) { // this should be extremely fast for large count as it uses the same algoithim as efficient integer powers // ??? need to test to see how large count and n need to be for this to be fastest approach int block = size; int pos = size; while (pos < newCount) { Array.Copy(ret, 0, ret, pos, Math.Min(block, newCount - pos)); pos += block; block *= 2; } } return(ret); }