Message-ID: <35C14346.6A03@icrdl.net> From: Michel Huot MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: 80x87 detection in DJGPP programs Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 24 Date: Fri, 31 Jul 1998 04:09:18 GMT NNTP-Posting-Host: 207.236.233.104 NNTP-Posting-Date: Fri, 31 Jul 1998 00:09:18 EDT Organization: Bell Solutions To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi Im making a 3d engine and i needed a sqrt routine. The DJGPP library sqrt() is fast when the machine have a coprocessor, but the emulation is terribly slow. Since i works with fixed point i wrote an integer sqrt routine, which is faster. On the other hand, it is slower than a 80x87. So my question is: how can I detect a 80x87 in a DJGPP program? The following code works fine on a machine that own a 80x87 but i get an SIGOFP exception when running it on a machine that dont own one: int Test8087(void) { int a= 0; __asm__ __volatile__ ( "finit fstcw (%%ebx) : : "b" (&a)); return(((a>> 8)& 0xff)== 3); } Anyone knows how to get it works on a machine that dont own a 80x87? PS. Sorry for my bad english im french