Skip to content

Instantly share code, notes, and snippets.

@stryku
Last active April 9, 2017 20:23
Show Gist options
  • Save stryku/1c47658a5301b28bc1ee7c15ac2dc8ba to your computer and use it in GitHub Desktop.
Save stryku/1c47658a5301b28bc1ee7c15ac2dc8ba to your computer and use it in GitHub Desktop.
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>; };
...
}
template <typename token>
constexpr auto token_to_reg_opcode = details::token_to_reg_opcode_impl<token>::value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment