Skip to content

Commit

Permalink
Update IntArrayComparer.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
natsurainko committed Nov 6, 2024
1 parent f932e88 commit fcb8353
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Natsurainko.FluentLauncher/Utils/IntArrayComparer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;

namespace Natsurainko.FluentLauncher.Utils;

Expand All @@ -15,9 +16,18 @@ public int Compare(int[]? x, int[]? y)
if (y == null) return 1;
}


if (x.Length != y.Length)
return x.Length > y.Length ? 1 : -1;
{
int compare = x.Length > y.Length
? Compare(x.Take(y.Length).ToArray(), y)
: Compare(x, y.Take(x.Length).ToArray());

return compare != 0
? compare
: x.Length > y.Length
? 1
: -1;
}

for (int i = 0; i < x.Length; i++)
if (x[i] > y[i])
Expand Down

0 comments on commit fcb8353

Please sign in to comment.