mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 18:29:28 +02:00
* x87 optimized version of math.log2() for i8086, i386 and x86_64
git-svn-id: trunk@26266 -
This commit is contained in:
parent
90b69184f1
commit
4eb9043ac7
@ -74,6 +74,16 @@ function cotan(x : float) : float;assembler;
|
||||
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
|
||||
|
@ -79,6 +79,16 @@ procedure sincos(theta : single;out sinus,cosinus : single);assembler;
|
||||
end;}
|
||||
|
||||
|
||||
{$define FPC_MATH_HAS_LOG2}
|
||||
function log2(x : float) : float;assembler;
|
||||
asm
|
||||
fld1
|
||||
fld tbyte [x]
|
||||
fyl2x
|
||||
fwait
|
||||
end;
|
||||
|
||||
|
||||
{//$define FPC_MATH_HAS_DIVMOD}
|
||||
{procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: Word);assembler;
|
||||
asm
|
||||
|
@ -851,10 +851,12 @@ function log10(x : float) : float;
|
||||
log10:=ln(x)*0.43429448190325182765; { 1/ln(10) }
|
||||
end;
|
||||
|
||||
{$ifndef FPC_MATH_HAS_LOG2}
|
||||
function log2(x : float) : float;
|
||||
begin
|
||||
log2:=ln(x)*1.4426950408889634079; { 1/ln(2) }
|
||||
end;
|
||||
{$endif FPC_MATH_HAS_LOG2}
|
||||
|
||||
function logn(n,x : float) : float;
|
||||
begin
|
||||
|
@ -42,6 +42,16 @@ function cotan(x : float) : float;assembler;
|
||||
fdivp %st,%st(1)
|
||||
fwait
|
||||
end;
|
||||
|
||||
|
||||
{$define FPC_MATH_HAS_LOG2}
|
||||
function log2(x : float) : float;assembler;
|
||||
asm
|
||||
fld1
|
||||
fldt x
|
||||
fyl2x
|
||||
fwait
|
||||
end;
|
||||
{$endif FPC_HAS_TYPE_EXTENDED}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user