Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- int x=0xBAE2,y=101;
- asm volatile (
- ".intel_syntax noprefix;"
- "mov eax,%1;"
- "xor ecx,ecx;"
- "checking:"
- "xor ebx,ebx;"
- "mov ebx,eax;"
- "and ebx,7;"
- "cmp ebx,5;"
- "jnz shifting;"
- "inc ecx;"
- "shifting:"
- "shr eax;"
- "and eax,eax;"
- "jnz checking;"
- "mov %0,ecx;"
- ".att_syntax prefix;"
- :"=r" (y)
- :"r" (x)
- :"eax"
- );
- printf("x=%x y=%d \n",x,y);
- return 0;
- }
- //Zadanie:
- //Liczba wystapien np. bitu "101": powinny byc 3 ciagi.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement