Files
rgbds/include/asm/macro.hpp
T
Rangi 21682e8814 Consistently handle negative shifted macro args (#2014)
Negative macro arguments count from the end, i.e. `\<-1>`
is equivalent to `\<_NARG>`, even after `shift`ing them.

Negative arguments cannot be used to access shifted values.
2026-07-07 02:19:37 -04:00

24 lines
533 B
C++

// SPDX-License-Identifier: MIT
#ifndef RGBDS_ASM_MACRO_HPP
#define RGBDS_ASM_MACRO_HPP
#include <memory>
#include <stdint.h>
#include <string>
#include <vector>
struct MacroArgs {
uint32_t shift;
std::vector<std::shared_ptr<std::string>> args;
uint32_t nbArgs() const { return args.size() - shift; }
std::shared_ptr<std::string> getArg(int32_t num) const;
std::shared_ptr<std::string> getAllArgs() const;
void appendArg(std::shared_ptr<std::string> arg);
void shiftArgs(int32_t count);
};
#endif // RGBDS_ASM_MACRO_HPP