Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //asm(".intel_syntax noprefix");
- //asm(".att_syntax prefix");
- /*usa assembler extend con inclusion explicita de la instruccion imul*/
- int test(){
- //dos int de 4 bytes
- struct punto {int x;int y;int z;};
- punto p {5,6,7};
- int salida(0);
- asm (
- "inicio:"
- "nop;"
- "movl 4%1,%0"/*0 accedo x, 4 accedo y 8 accedo z*/
- :"=b"(salida) /* output %0*/
- :"m"(p) /* input %1 en la memoria*/
- : /* clobbered register */
- );
- return salida;
- };
- int main(){
- cout <<"size of int =" <<sizeof (int)<<endl;
- cout <<"lectura de la estructura punto.x = "<<test()<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement