mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: improve performance of dtDisjointSet::setUnion
Don't index multiple times into the same array with the same index.
This commit is contained in:
parent
e28ea6cab1
commit
5ab83f2db4
@ -153,14 +153,17 @@ public:
|
||||
if (sx == sy) // Same set already.
|
||||
return;
|
||||
|
||||
if (rank[sx] < rank[sy])
|
||||
int& rankSx = rank[sx];
|
||||
int& rankSy = rank[sy];
|
||||
|
||||
if (rankSx < rankSy)
|
||||
parent[sx] = sy;
|
||||
else if (rank[sx] > rank[sy])
|
||||
else if (rankSx > rankSy)
|
||||
parent[sy] = sx;
|
||||
else
|
||||
{
|
||||
parent[sy] = sx;
|
||||
rank[sx] += 1;
|
||||
rankSx += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user