Prepare SPU and IO Ports related code

This commit is contained in:
Jaby
2022-08-31 15:18:30 +02:00
parent 367e4d5b3f
commit febdfb0162
6 changed files with 171 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
#ifndef __JABYENGINE_IO_CLASS_HELPER_HPP__
#define __JABYENGINE_IO_CLASS_HELPER_HPP__
#include "bits.hpp"
#define io_class__2option_map(option0, option1, bit_num) \
constexpr void set_##option0() { \
this->raw_value = bit::clear(this->raw_value, bit_num); \
} \
\
constexpr void set_##option1() { \
this->raw_value = bit::set(this->raw_value, bit_num); \
}
#define io_class__2option_map_getter(type, option0, option1, name, bit_num) \
io_class__2option_map(option0, option1, bit_num) \
io_class__option_as(type, name, bit_num)
#define io_class__option_as(type, name, bit_num) \
constexpr type get_##name() const { \
return static_cast<type>(bit::is_set(this->raw_value, bit_num)); \
}
#endif //!__JABYENGINE_IO_CLASS_HELPER_HPP__