Guest User

Untitled

a guest
Jan 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "xbyak/xbyak.h"
  3.  
  4. struct TestFunc : public Xbyak::CodeGenerator {
  5. TestFunc() {
  6. mov(eax, ptr[esp+4]);
  7. add(eax, ptr[esp+8]);
  8. ret();
  9. }
  10. };
  11.  
  12. int main() {
  13. TestFunc testf;
  14. auto test = reinterpret_cast<int(*)(int, int)>(
  15. const_cast<Xbyak::uint8 *>(testf.getCode()));
  16. printf("test(2, 3): %d\n", test(2, 3));
  17. }
Add Comment
Please, Sign In to add comment