This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <int value> | |
struct prepare_sign_and_convert | |
{ | |
using type = typename std::conditional_t< | |
value < 0, | |
string_from_int_impl<value * -1, string<'-'>>, | |
string_from_int_impl<value, string<>> | |
>::type; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <size_t, bool, typename> | |
struct values_drop_impl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <size_t ...left> | |
struct values_drop_impl<0, true, values_container<left...>> | |
{ | |
using type = values_container<left...>; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <size_t count, size_t to_drop, size_t ...left> | |
struct values_drop_impl<count, false, values_container<to_drop, left...>> | |
{ | |
using type = typename values_drop_impl<count-1, | |
count == 1, | |
values_container<left...>>::type; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace details | |
{ | |
template <size_t, bool, typename> | |
struct values_drop_impl; | |
template <size_t ...left> | |
struct values_drop_impl<0, true, values_container<left...>> | |
{ | |
using type = values_container<left...>; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <size_t ...values> | |
struct values_container | |
{}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename ...args> | |
struct tuple | |
{}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace cai | |
{ | |
namespace tokens | |
{ | |
using tok_empty = decltype(""_s); | |
using tok_exit = decltype("exit"_s); | |
using tok_mov = decltype("mov"_s); | |
using tok_add = decltype("add"_s); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename type, typename ...types> | |
constexpr auto is_type_in_v = ((std::is_same<type, types>::value) || ...); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace details | |
{ | |
template <typename> | |
struct token_to_reg_opcode_impl; | |
template <> struct token_to_reg_opcode_impl<tokens::tok_eax> { static constexpr auto value = regs::to_size<regs::id_t::EAX>; }; | |
template <> struct token_to_reg_opcode_impl<tokens::tok_ebx> { static constexpr auto value = regs::to_size<regs::id_t::EBX>; }; | |
... | |
} |