mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Using C++20 [[unlikely]] here would be excessive micro-optimization
This commit is contained in:
@@ -30,13 +30,11 @@ static std::vector<std::vector<FileStackNode>> nodes;
|
|||||||
|
|
||||||
// Helper functions for reading object files
|
// Helper functions for reading object files
|
||||||
|
|
||||||
// Internal, DO NOT USE.
|
// For internal use only by `tryReadLong` and `tryGetc`!
|
||||||
// For helper wrapper macros defined below, such as `tryReadLong`
|
|
||||||
#define tryRead(func, type, errval, vartype, var, file, ...) \
|
#define tryRead(func, type, errval, vartype, var, file, ...) \
|
||||||
do { \
|
do { \
|
||||||
FILE *tmpFile = file; \
|
FILE *tmpFile = file; \
|
||||||
type tmpVal = func(tmpFile); \
|
type tmpVal = func(tmpFile); \
|
||||||
/* TODO: maybe mark the condition as `unlikely`; how to do that portably? */ \
|
|
||||||
if (tmpVal == (errval)) { \
|
if (tmpVal == (errval)) { \
|
||||||
errx(__VA_ARGS__, feof(tmpFile) ? "Unexpected end of file" : strerror(errno)); \
|
errx(__VA_ARGS__, feof(tmpFile) ? "Unexpected end of file" : strerror(errno)); \
|
||||||
} \
|
} \
|
||||||
|
|||||||
Reference in New Issue
Block a user