Hello, llueveYescampa <edgarfbl...@gmail.com> writes: > Hi all, > > A couple of years ago, working with OpenWatcom for Windows, I was > able to wrote the inline assembly code shown below. I spent a while > reading and by trail an error I made it work. > > I was trying to test the efficiency of the "inner_product()" function > in C++. > > Now I am working in Linux and I would like to compile it with g++. > > Is the inline assembly of g++ similar? > Can some of this code be reused in g++?
inline assembler of gcc is different. For example all register are prefixed by "%". All constants are prefixed by "$". See: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html Here a simple example #include <iostream> int function(void) { int result; asm( "mov $0x2, %%eax\n\t" "mov $3, %%ebx\n\t" "add %%ebx, %%eax\n\t" "mov %%eax, %0\n\t" : "=r"(result) : : "%eax", "%ebx" ); return result; } int main(void) { std::cout << function() << std::endl; return 0; } Viele Grüße Sebastian Waschik _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus