mirror of
https://github.com/gbdev/rgbds.git
synced 2026-11-26 06:18:39 +00:00
Sort linked sections by alignment before size (#2201)
Note that Libbet has no canonical hash and is sensitive to floating section placement
This commit is contained in:
1 parent
d73a05aa78
commit
9d6dab13d8
4 files changed
+15
-8
No files matched your search
+9
-7
@@ -416,14 +416,16 @@ static void categorizeSection(Section §ion) {
|
||||
constraints |= ALIGN_CONSTRAINED;
|
||||
}
|
||||
|
||||
// Insert section while keeping the list sorted by decreasing alignment and size
|
||||
std::deque<Section *> §ions = unassignedSections[constraints];
|
||||
|
||||
// Insert section while keeping the list sorted by decreasing size
|
||||
auto pos = sections.begin();
|
||||
while (pos != sections.end() && (*pos)->size > section.size) {
|
||||
++pos;
|
||||
}
|
||||
sections.insert(pos, §ion);
|
||||
auto const compareSections = [](Section const *prev, Section const §) {
|
||||
assume(prev->isAlignFixed == sect.isAlignFixed);
|
||||
if (sect.isAlignFixed && prev->alignMask != sect.alignMask) {
|
||||
return prev->alignMask > sect.alignMask;
|
||||
}
|
||||
return prev->size > sect.size;
|
||||
};
|
||||
sections.insert(std::lower_bound(RANGE(sections), section, compareSections), §ion);
|
||||
}
|
||||
|
||||
static void checkOverlayCompat() {
|
||||
|
||||
Reference in new issue
Block a user