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 "gfx/proto_palette.hpp"
#include <algorithm>
#include <assert.h>
#include "helpers.hpp"
@@ -41,8 +40,8 @@ bool ProtoPalette::add(uint16_t color) {
ProtoPalette::ComparisonResult ProtoPalette::compare(ProtoPalette const &other) const {
// This works because the sets are sorted numerically
assert(std::is_sorted(RANGE(_colorIndices)));
assert(std::is_sorted(RANGE(other._colorIndices)));
assume(std::is_sorted(RANGE(_colorIndices)));
assume(std::is_sorted(RANGE(other._colorIndices)));
auto ours = _colorIndices.begin(), theirs = other._colorIndices.begin();
bool weBigger = true, theyBigger = true;