This source file includes following definitions.
- fld_const
- fld1
- fldl2t
- fldl2e
- fldpi
- fldlg2
- fldln2
- fldz
- fconst
1
2
3
4
5
6
7
8
9
10
11
12 #include "fpu_system.h"
13 #include "fpu_emu.h"
14 #include "status_w.h"
15 #include "reg_constant.h"
16
17
18 FPU_REG CONST_1 = { SIGN_POS, TW_Valid, EXP_BIAS,
19 0x00000000, 0x80000000 };
20 FPU_REG CONST_2 = { SIGN_POS, TW_Valid, EXP_BIAS+1,
21 0x00000000, 0x80000000 };
22 FPU_REG CONST_HALF = { SIGN_POS, TW_Valid, EXP_BIAS-1,
23 0x00000000, 0x80000000 };
24 FPU_REG CONST_L2T = { SIGN_POS, TW_Valid, EXP_BIAS+1,
25 0xcd1b8afe, 0xd49a784b };
26 FPU_REG CONST_L2E = { SIGN_POS, TW_Valid, EXP_BIAS,
27 0x5c17f0bc, 0xb8aa3b29 };
28 FPU_REG CONST_PI = { SIGN_POS, TW_Valid, EXP_BIAS+1,
29 0x2168c235, 0xc90fdaa2 };
30 FPU_REG CONST_PI2 = { SIGN_POS, TW_Valid, EXP_BIAS,
31 0x2168c235, 0xc90fdaa2 };
32 FPU_REG CONST_PI4 = { SIGN_POS, TW_Valid, EXP_BIAS-1,
33 0x2168c235, 0xc90fdaa2 };
34 FPU_REG CONST_LG2 = { SIGN_POS, TW_Valid, EXP_BIAS-2,
35 0xfbcff799, 0x9a209a84 };
36 FPU_REG CONST_LN2 = { SIGN_POS, TW_Valid, EXP_BIAS-1,
37 0xd1cf79ac, 0xb17217f7 };
38
39
40 FPU_REG CONST_Z = { SIGN_POS, TW_Zero, 0, 0x0, 0x0 };
41
42
43
44
45
46
47 FPU_REG CONST_QNaN = { SIGN_NEG, TW_NaN, EXP_OVER, 0x00000000, 0xC0000000 };
48
49
50 FPU_REG CONST_INF = { SIGN_POS, TW_Infinity, EXP_OVER, 0x00000000, 0x80000000 };
51
52
53
54 static void fld_const(FPU_REG *c)
55 {
56 FPU_REG *st_new_ptr;
57
58 if ( STACK_OVERFLOW )
59 {
60 stack_overflow();
61 return;
62 }
63 push();
64 reg_move(c, FPU_st0_ptr);
65 status_word &= ~SW_C1;
66 }
67
68
69 static void fld1(void)
70 {
71 fld_const(&CONST_1);
72 }
73
74 static void fldl2t(void)
75 {
76 fld_const(&CONST_L2T);
77 }
78
79 static void fldl2e(void)
80 {
81 fld_const(&CONST_L2E);
82 }
83
84 static void fldpi(void)
85 {
86 fld_const(&CONST_PI);
87 }
88
89 static void fldlg2(void)
90 {
91 fld_const(&CONST_LG2);
92 }
93
94 static void fldln2(void)
95 {
96 fld_const(&CONST_LN2);
97 }
98
99 static void fldz(void)
100 {
101 fld_const(&CONST_Z);
102 }
103
104 static FUNC constants_table[] = {
105 fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, Un_impl
106 };
107
108 void fconst(void)
109 {
110 (constants_table[FPU_rm])();
111 }