Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int powerOf2(int, int*){
- _asm{
- mov esi, [ebp + 12]
- mov ecx, [ebp + 8]
- xor eax, eax
- _loop :
- dec ecx
- cmp ecx, 0
- jl finish
- mov edi, [esi + ecx*4]
- cmp edi, 0
- jz _loop
- mov ebx, edi
- dec ebx
- and ebx, edi
- jnz _loop
- inc eax
- jmp _loop
- finish :
- }
- }
- int main()
- {
- int n, v[25], nr;
- cin >> n;
- for (int i = 0; i < n; i++)
- cin >> v[i];
- _asm
- {
- lea edi, v;
- push v;
- push n;
- call powerOf2;
- add esp, 8;
- mov nr, eax;
- }
- cout << nr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement