mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-23 02:42:09 +00:00
fs.mitm: Optimize out remaining O(n^2) op. BotW is very fast.
This commit is contained in:
parent
90226ec438
commit
4c920dfe92
2 changed files with 7 additions and 10 deletions
|
@ -273,12 +273,10 @@ void RomFSBuildContext::Build(std::vector<RomFSSourceInfo> *out_infos) {
|
||||||
/* Assign deferred parent/sibling ownership. */
|
/* Assign deferred parent/sibling ownership. */
|
||||||
if (cur_file->parent->file == NULL) {
|
if (cur_file->parent->file == NULL) {
|
||||||
cur_file->parent->file = cur_file;
|
cur_file->parent->file = cur_file;
|
||||||
|
cur_file->parent->tail = cur_file;
|
||||||
} else {
|
} else {
|
||||||
RomFSBuildFileContext *temp = cur_file->parent->file;
|
((RomFSBuildFileContext *)cur_file->parent->tail)->sibling = cur_file;
|
||||||
while (temp->sibling != NULL) {
|
cur_file->parent->tail = cur_file;
|
||||||
temp = temp->sibling;
|
|
||||||
}
|
|
||||||
temp->sibling = cur_file;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prev_file = cur_file;
|
prev_file = cur_file;
|
||||||
|
@ -295,12 +293,10 @@ void RomFSBuildContext::Build(std::vector<RomFSSourceInfo> *out_infos) {
|
||||||
if (cur_dir != this->root) {
|
if (cur_dir != this->root) {
|
||||||
if (cur_dir->parent->child == NULL) {
|
if (cur_dir->parent->child == NULL) {
|
||||||
cur_dir->parent->child = cur_dir;
|
cur_dir->parent->child = cur_dir;
|
||||||
|
cur_dir->parent->tail = cur_dir;
|
||||||
} else {
|
} else {
|
||||||
RomFSBuildDirectoryContext *temp = cur_dir->parent->child;
|
((RomFSBuildDirectoryContext *)cur_dir->parent->tail)->sibling = cur_dir;
|
||||||
while (temp->sibling != NULL) {
|
cur_dir->parent->tail = cur_dir;
|
||||||
temp = temp->sibling;
|
|
||||||
}
|
|
||||||
temp->sibling = cur_dir;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,7 @@ struct RomFSBuildDirectoryContext {
|
||||||
RomFSBuildDirectoryContext *child = NULL;
|
RomFSBuildDirectoryContext *child = NULL;
|
||||||
RomFSBuildDirectoryContext *sibling = NULL;
|
RomFSBuildDirectoryContext *sibling = NULL;
|
||||||
RomFSBuildFileContext *file = NULL;
|
RomFSBuildFileContext *file = NULL;
|
||||||
|
void *tail;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RomFSBuildFileContext {
|
struct RomFSBuildFileContext {
|
||||||
|
|
Loading…
Reference in a new issue