{ This file is part of the Free Pascal run time library. Copyright (c) 1999-2003 by Florian Klaempfl member of the Free Pascal development team See the file COPYING.FPC, included in this distribution, for details about the copyright. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. **********************************************************************} {$ASMMODE ATT} {$define FPC_MATH_HAS_ARCTAN2} function arctan2(y,x : float) : float;assembler; asm fldt y fldt x fpatan fwait end; {$define FPC_MATH_HAS_SINCOS} procedure sincos(theta : extended;out sinus,cosinus : extended);assembler; asm fldt theta fsincos fstpt (%edx) fstpt (%eax) fwait end; procedure sincos(theta : double;out sinus,cosinus : double);assembler; asm fldl theta fsincos fstpl (%edx) fstpl (%eax) fwait end; procedure sincos(theta : single;out sinus,cosinus : single);assembler; asm flds theta fsincos fstps (%edx) fstps (%eax) fwait end; {$define FPC_MATH_HAS_TAN} function tan(x : float) : float;assembler; asm fldt X fptan fstp %st fwait end; {$define FPC_MATH_HAS_COTAN} function cotan(x : float) : float;assembler; asm fldt X fptan fdivp %st,%st(1) fwait end; {$define FPC_MATH_HAS_LOG2} function log2(x : float) : float;assembler; asm fld1 fldt x fyl2x fwait end; {$define FPC_MATH_HAS_DIVMOD} procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: Word);assembler; asm pushl %edi movzwl %dx,%edi cltd idiv %edi movw %ax,(%ecx) movl Remainder,%ecx movw %dx,(%ecx) popl %edi end; procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: SmallInt);assembler; asm pushl %edi movzwl %dx,%edi cltd idiv %edi movw %ax,(%ecx) movl Remainder,%ecx movw %dx,(%ecx) popl %edi end; procedure DivMod(Dividend: DWord; Divisor: DWord; var Result, Remainder: DWord);assembler; asm pushl %edi movl %edx,%edi xorl %edx,%edx div %edi movl %eax,(%ecx) movl Remainder,%ecx movl %edx,(%ecx) popl %edi end; procedure DivMod(Dividend: Integer; Divisor: Integer; var Result, Remainder: Integer);assembler; asm pushl %edi movl %edx,%edi cltd idiv %edi movl %eax,(%ecx) movl Remainder,%ecx movl %edx,(%ecx) popl %edi end;