Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 1
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2
#include
3
	.data
4
yint:
5
	.word   0,0
6
LCW1:
7
	.word	0
8
LCW2:
9
	.word	0
10
 
11
	.text
12
LC0:
13
	.double	0d1.0e+00
14
 
15
frac:
16
	fstcw	LCW1
17
	fstcw	LCW2
18
	fwait
19
	andw	$0xf3ff,LCW2
20
	orw	$0x0400,LCW2
21
	fldcw	LCW2
22
	fldl	%st(0)
23
	frndint
24
	fldcw	LCW1
25
	fxch	%st(1)
26
	fsub	%st(1),%st
27
	ret
28
 
29
Lpow2:
30
	call    frac
31
	f2xm1
32
	faddl	LC0
33
	fscale
34
	fstp	%st(1)
35
	ret
36
 
37
MK_C_SYM(pow)
38
	fldl	12(%esp)
39
	fldl	4(%esp)
40
	ftst
41
	fnstsw	%ax
42
	sahf
43
	jbe	xltez
44
	fyl2x
45
	jmp	Lpow2
46
xltez:
47
	jb	xltz
48
	fstp	%st(0)
49
	ftst
50
	fnstsw	%ax
51
	sahf
52
	ja	ygtz
53
	jb	error
54
	fstp	%st(0)
55
	fld1
56
	fchs
57
error:
58
	fsqrt
59
	ret
60
ygtz:
61
	fstp	%st(0)
62
	fldz
63
	ret
64
xltz:
65
	fabs
66
	fxch    %st(1)
67
	call	frac
68
	ftst
69
	fnstsw	%ax
70
	fstp	%st(0)
71
	sahf
72
	je	yisint
73
	fstp	%st(0)
74
	fchs
75
	jmp	error
76
yisint:
77
	fistl	yint
78
	fxch    %st(1)
79
	fyl2x
80
	call	Lpow2
81
	andl	$1,yint
82
	jz	yeven
83
	fchs
84
yeven:
85
	ret
86