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++? I like to thank all of you in advance for your comments. Edgar Black +++++++++++++++++++++++++++++++++++++++++++++++++ double dot_product(double *array1, double *array1End, double *array2) { double result; const unsigned int n = array1End-array1; _asm { fldz mov ecx, n cmp ecx,0 jz finish mov esi,array1 mov edi,array2 more: fld qword ptr [esi] fmul qword ptr [edi] faddp st(1),st(0) add esi,8 add edi,8 loop more finish: fstp qword ptr result } // end asm // return (result); } // end of dot_product// +++++++++++++++++++++++++++++++++++++++++++++++++ _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus