mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Trivially optimize iteration order in loops
Due to how node data is stored iterating X last provides better cache locality.
This commit is contained in:
parent
2efd0996e6
commit
92d03f3832
4 changed files with 35 additions and 38 deletions
|
@ -291,9 +291,9 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
|||
bool any_position_valid = false;
|
||||
|
||||
v3s16 p;
|
||||
for (p.X = min.X; p.X <= max.X; p.X++)
|
||||
for (p.Z = min.Z; p.Z <= max.Z; p.Z++)
|
||||
for (p.Y = min.Y; p.Y <= max.Y; p.Y++)
|
||||
for (p.Z = min.Z; p.Z <= max.Z; p.Z++) {
|
||||
for (p.X = min.X; p.X <= max.X; p.X++) {
|
||||
bool is_position_valid;
|
||||
MapNode n = map->getNode(p, &is_position_valid);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue