Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication16.cpp : Defines the entry point for the console application.
- //
- #include "ctime"
- #include "iostream"
- using namespace std;
- int main()
- {
- __declspec(align(64))__int64 x[16]; //= { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 10 };
- __declspec(align(64))__int64 y[16]; //= { 9, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 8};
- __declspec(align(64))__int64 eredmeny[16] = { 0 };
- __int64 *xp = x, *yp = y, *eredp = eredmeny;
- srand((unsigned)time(0));
- //RANDOM SZÁM GENERÁLÁSHOZ
- for (int i = 0; i<16; i++)
- {
- x[i] = rand() % 4;
- y[i] = rand() % 4;
- cout << (int)x[i] << "\t" << (int)y[i] << endl;
- }
- cout << endl << endl;
- __int64 nulla = 0;
- _asm
- {
- //HA NEM VEKTORKÉNT ADOM ÁT... :)))
- mov ecx, 0;
- cik:
- movss xmm0, nulla;
- movss xmm1, nulla;
- mov esi, xp;
- movss xmm0, [esi];
- add xp, 8;
- mov esi, yp;
- movss xmm1, [esi];
- add yp, 8;
- PSADBW xmm0, xmm1;
- mov esi, eredp;
- movss [esi], xmm0;
- jmp tarol;
- folyt:
- cmp ecx, 15;
- jz vege;
- inc ecx;
- jnz cik;
- tarol:
- movq mm0, [esi];
- paddq mm1, mm0;
- paddq mm0, nulla;
- mov eax, eredp;
- movq [eax], mm1;
- jmp folyt;
- vege:
- //VEKTORKÉNT ADOM ÁT... :/
- //mov esi, xp;
- //movaps xmm0, [esi]//ez már vektorként kezeli
- //mov esi, yp;
- //movaps xmm1, [esi]
- //PSADBW mm0, mm1;
- //mov esi, eredp;
- //movaps[esi], xmm0;
- }
- /*for (int i = 0; i < 16; i++)
- {
- cout<<eredmeny[i];
- }*/
- //unsigned char manhattam = eredmeny[];//+eredmeny[2]+...ha átadná a következő tömbelem párost...
- __int64 manh8 = eredmeny[0];
- cout <<"A manhattam tavolsaguk: "<<(int)manh8<<endl;
- cout << "ellenorizd le azert :P" << endl << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement