mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Use std::get_if instead of std::visit (#1367)
`std::visit` is (arguably) cleaner code, but older versions of gcc and clang (not very old; the ones packaged with Ubuntu 22.04 LTS) compile them as tables of function pointers, instead of efficient jump tables.
This commit is contained in:
@@ -27,8 +27,8 @@ Label const &Symbol::label() const {
|
||||
|
||||
void sym_AddSymbol(Symbol &symbol) {
|
||||
Symbol *other = sym_GetSymbol(symbol.name);
|
||||
int32_t const *symValue = std::get_if<int32_t>(&symbol.data);
|
||||
int32_t const *otherValue = other ? std::get_if<int32_t>(&other->data) : nullptr;
|
||||
auto *symValue = std::get_if<int32_t>(&symbol.data);
|
||||
auto *otherValue = other ? std::get_if<int32_t>(&other->data) : nullptr;
|
||||
|
||||
// Check if the symbol already exists with a different value
|
||||
if (other && !(symValue && otherValue && *symValue == *otherValue)) {
|
||||
|
||||
Reference in New Issue
Block a user