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,10 +3,11 @@
#ifndef RGBDS_LINKDEFS_H
#define RGBDS_LINKDEFS_H
#include <assert.h>
#include <stdint.h>
#include <string>
#include "helpers.hpp" // assume
#define RGBDS_OBJECT_VERSION_STRING "RGBA"
#define RGBDS_OBJECT_REV 10U
@@ -93,7 +94,7 @@ extern struct SectionTypeInfo {
* @return `true` if the section's definition includes data
*/
static inline bool sect_HasData(SectionType type) {
assert(type != SECTTYPE_INVALID);
assume(type != SECTTYPE_INVALID);
return type == SECTTYPE_ROM0 || type == SECTTYPE_ROMX;
}