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*/
- char foo(char *c){
- int b(4);
- asm (
- "inc %1;"/* incrementa puntero de chars c*/
- "mov (%1), %%eax;" /* carga el contenido del puntero el contenido de c en eax*/
- "mov %%eax,%0;" /* carga eax en b la salida */
- :"=r"(b) /* output %0*/
- :"r"(c) /* input %1*/
- :"%eax" /* clobbered register */
- );
- return b;
- };
- int main(){
- char cadena []="alfa";
- cout <<" salida "<<foo(&cadena[0])<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement