Advertisement
Verzingz

C++ ASM

Jan 1st, 2018
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. // !\\\\\\\\\\ Structs & Classes \\\\\\\\\\!
  4. struct stASM {
  5.     template<typename T> T
  6.     inline const printValue(T tValue) {
  7.         _asm {
  8.             mov eax, tValue
  9.         }
  10.     }
  11.  
  12.     template<typename T> T
  13.     inline const subtractValue(T tSubtractFrom, T tSubtractBy) {
  14.         _asm {
  15.             mov eax, tSubtractFrom
  16.             sub eax, tSubtractBy
  17.         }
  18.     }
  19. };
  20.  
  21. // !\\\\\\\\\\\\\\ Main Code \\\\\\\\\\\\\\!
  22. stASM stASMObj;
  23.  
  24. int main() {
  25.     uintptr_t uipValue = 10;
  26.     uintptr_t uipSubtractValue = 5;
  27.  
  28.     std::cout << "Value = " << stASMObj.printValue(uipValue) << "\n";
  29.     std::cout << "Value - Subtract Value = " << stASMObj.subtractValue(uipValue, uipSubtractValue) << "\n";
  30.  
  31.     std::cin.get();
  32.     return EXIT_SUCCESS;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement