static void Intern(int[] a, int start, int count) { if (count > 2048) { int firstCount = count >> 1; Intern(a, start, firstCount); Intern(a, start + firstCount, count - firstCount); Combine2Sections(a, start, count); } else if (count > 1) { Exchanging.Comb(a, start, count); } }
static void InternTri(int[] a, int start, int count) { if (count > 2048) { int firstCount = count / 3; InternTri(a, start, firstCount); InternTri(a, start + firstCount, firstCount); InternTri(a, start + (firstCount << 1), count - (firstCount << 1)); Combine3Sections(a, start, count); } else if (count > 1) { Exchanging.Comb(a, start, count); } }
public static int[] StartTri(int[] a) { for (int start = 0; start + 1 < a.Length; start += 2048) { Exchanging.Comb(a, start, System.Math.Min(a.Length - start, 2048)); } for (int size = 2048; size < a.Length; size *= 3) { for (int u = 0; u + size < a.Length; u += size * 3) { Combine3Sections(a, u, size); } } return(a); }
public static int[] Start(int[] a) { for (int start = 0; start + 1 < a.Length; start += 2048) { Exchanging.Comb(a, start, System.Math.Min(a.Length - start, 2048)); } for (int firstCount = 1; firstCount < a.Length; firstCount <<= 1) { for (int start = 0; start + firstCount < a.Length; start += (firstCount << 1)) { Combine2Sections(a, start, firstCount); } } return(a); }