Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. // ConsoleApplication16.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "ctime"
  5. #include "iostream"
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. __declspec(align(64))__int64 x[16]; //= { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 10 };
  12. __declspec(align(64))__int64 y[16]; //= { 9, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 8};
  13. __declspec(align(64))__int64 eredmeny[16] = { 0 };
  14. __int64 *xp = x, *yp = y, *eredp = eredmeny;
  15. srand((unsigned)time(0));
  16. //RANDOM SZÁM GENERÁLÁSHOZ
  17. for (int i = 0; i<16; i++)
  18. {
  19. x[i] = rand() % 4;
  20. y[i] = rand() % 4;
  21. cout << (int)x[i] << "\t" << (int)y[i] << endl;
  22. }
  23. cout << endl << endl;
  24. __int64 nulla = 0;
  25. _asm
  26. {
  27. //HA NEM VEKTORKÉNT ADOM ÁT... :)))
  28. mov ecx, 0;
  29. cik:
  30. movss xmm0, nulla;
  31. movss xmm1, nulla;
  32. mov esi, xp;
  33. movss xmm0, [esi];
  34. add xp, 8;
  35.  
  36. mov esi, yp;
  37. movss xmm1, [esi];
  38. add yp, 8;
  39.  
  40. PSADBW xmm0, xmm1;
  41. mov esi, eredp;
  42. movss [esi], xmm0;
  43. jmp tarol;
  44.  
  45. folyt:
  46. cmp ecx, 15;
  47. jz vege;
  48. inc ecx;
  49. jnz cik;
  50.  
  51. tarol:
  52. movq mm0, [esi];
  53. paddq mm1, mm0;
  54. paddq mm0, nulla;
  55. mov eax, eredp;
  56. movq [eax], mm1;
  57. jmp folyt;
  58.  
  59. vege:
  60.  
  61. //VEKTORKÉNT ADOM ÁT... :/
  62. //mov esi, xp;
  63. //movaps xmm0, [esi]//ez már vektorként kezeli
  64. //mov esi, yp;
  65. //movaps xmm1, [esi]
  66. //PSADBW mm0, mm1;
  67. //mov esi, eredp;
  68. //movaps[esi], xmm0;
  69.  
  70. }
  71.  
  72. /*for (int i = 0; i < 16; i++)
  73. {
  74. cout<<eredmeny[i];
  75. }*/
  76. //unsigned char manhattam = eredmeny[];//+eredmeny[2]+...ha átadná a következő tömbelem párost...
  77.  
  78. __int64 manh8 = eredmeny[0];
  79. cout <<"A manhattam tavolsaguk: "<<(int)manh8<<endl;
  80. cout << "ellenorizd le azert :P" << endl << endl;
  81.  
  82. system("PAUSE");
  83. return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement