Skip to content

Instantly share code, notes, and snippets.

template <typename reg_token,
typename mem_size_token,
typename mem_ptr_reg,
typename mem_ptr_const,
typename plus_minus_token,
typename ...rest_of_tokens>
template <typename reg_token, typename mem_size_token, typename mem_ptr_reg, typename mem_ptr_const, typename plus_minus_token, typename ...rest_of_tokens>
struct matcher_impl<tuple<
tokens::tok_mov,
reg_token,
tokens::tok_comma,
mem_size_token,
tokens::tok_ptr,
tokens::tok_square_bracket_open,
mem_ptr_reg,
plus_minus_token,
template <typename ...rest_of_tokens>
struct matcher_impl<tuple<tokens::tok_exit, rest_of_tokens...>>
{
using instruction = values_container<inst::to_size<inst::id_t::EXIT>>;
static constexpr auto eip_change = get_eip_change<inst::id_t::EXIT>;
using instruction_tokens = tuple<tokens::tok_exit>;
using rest_of_tokens_t = tuple<rest_of_tokens...>;
};
pop eax
pop ecx
cmp eax, 0
jg 23
mov ebx, 0
add ebx, ecx
cmp ecx, 0
jg 12
mov eax, ebx
ret
pop eax ; 0
pop ecx ; 2
cmp eax, 0 ; 4
jg end ; 7
mov ebx, 0 ; 9
loop:
add ebx, ecx ; 12
cmp ecx, 0 ; 15
jg loop ; 18
pop eax
pop ecx
cmp eax, 0
jg end
mov ebx, 0
loop:
add ebx, ecx
cmp ecx, 0
jg loop
namespace details
{
template <typename s, typename current_tokens = tuple<>>
struct tokenize_impl;
template <typename current_tokens>
struct tokenize_impl<string<>, current_tokens>
{
using tokens = current_tokens;
};
template <char curr_char, char ...str_chars, typename current_token>
struct get_token_impl<string<curr_char, str_chars...>, current_token>
{
using string_without_token_char = string<str_chars...>;
using result_t = get_token_impl<string_without_token_char, string_append<current_token, curr_char>>;
using result_token = typename result_t::result_token;
using rest_of_string = typename result_t::rest_of_string;
};
template <char ...str_chars, typename current_token>
struct get_token_impl<string<' ', str_chars...>, current_token>
{
using result_token = current_token;
using rest_of_string = string<str_chars...>;
};
template <typename current_token>
struct get_token_impl<string<>, current_token>
{
using result_token = current_token;
using rest_of_string = string<>;
};