Advertisement
Guest User

Untitled

a guest
May 27th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. // ïîèñê íåïàðíîãî.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include<conio.h>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. int ar[4] = { 128, 32, 2, 32};
  12. int x = 8;
  13. int res = 0;
  14. int ans = 0;
  15. int ans1 = 0;
  16. int ans2 = 0;
  17. __asm
  18. {
  19. mov edx, 3
  20. L:
  21. mov eax, ar[edx * 4]
  22. xor ebx, ebx
  23. mov ecx, 32
  24. //mov eax, x
  25. shifting :
  26. shl eax, 1
  27. jnc skip_inc
  28. inc ebx
  29. skip_inc :
  30. loop shifting
  31. mov res, ebx
  32. cmp res, 1
  33. jne cont
  34. inc ans
  35. cont:
  36. dec edx
  37. cmp edx, 0
  38. jl fin
  39. jmp L
  40. fin:
  41. mov eax, ans
  42. mov ans1, eax
  43.  
  44. xor ebx, ebx
  45. mov ecx, 32
  46. shifting2 :
  47. shl eax, 1
  48. jnc skip_inc2
  49. inc ebx
  50. skip_inc2 :
  51. loop shifting2
  52. mov ans2, ebx
  53. }
  54.  
  55. cout << "Elementov stepenei dvoiki: " << ans1 << endl;
  56. cout << "V chisle: " << ans1 << " edinits " << ans2;
  57. _getch();
  58. return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement