Replace assert with assume for release build optimization (#1390)

This commit is contained in:
Sylvie
2024-04-02 11:09:31 -04:00
committed by GitHub
parent 1d39e5ed56
commit a234da42a6
26 changed files with 158 additions and 147 deletions

View File

@@ -3,7 +3,6 @@
#include "link/output.hpp"
#include <algorithm>
#include <assert.h>
#include <deque>
#include <inttypes.h>
#include <stdio.h>
@@ -162,7 +161,7 @@ static void
if (bankSections) {
for (Section const *section : *bankSections) {
assert(section->offset == 0);
assume(section->offset == 0);
// Output padding up to the next SECTION
while (offset + baseOffset < section->org) {
putc(overlayFile ? getc(overlayFile) : padValue, outputFile);
@@ -407,7 +406,7 @@ static void writeMapBank(SortedSections const &sectList, SectionType type, uint3
Section const *sect = *pickedSection;
used += sect->size;
assert(sect->offset == 0);
assume(sect->offset == 0);
writeEmptySpace(prevEndAddr, sect->org);