File: /usr/src/linux/arch/ppc/math-emu/types.c
1 /*
2 * BK Id: SCCS/s.types.c 1.5 05/17/01 18:14:23 cort
3 */
4
5 #include "soft-fp.h"
6 #include "double.h"
7 #include "single.h"
8
9 void
10 fp_unpack_d(long *_s, unsigned long *_f1, unsigned long *_f0,
11 long *_e, long *_c, void *val)
12 {
13 FP_DECL_D(X);
14
15 __FP_UNPACK_RAW_2(D, X, val);
16
17 _FP_UNPACK_CANONICAL(D, 2, X);
18
19 *_s = X_s;
20 *_f1 = X_f1;
21 *_f0 = X_f0;
22 *_e = X_e;
23 *_c = X_c;
24 }
25
26 int
27 fp_pack_d(void *val, long X_s, unsigned long X_f1,
28 unsigned long X_f0, long X_e, long X_c)
29 {
30 int exc;
31
32 exc = _FP_PACK_CANONICAL(D, 2, X);
33 if (!exc || !__FPU_TRAP_P(exc))
34 __FP_PACK_RAW_2(D, val, X);
35 return exc;
36 }
37
38 int
39 fp_pack_ds(void *val, long X_s, unsigned long X_f1,
40 unsigned long X_f0, long X_e, long X_c)
41 {
42 FP_DECL_S(__X);
43 int exc;
44
45 FP_CONV(S, D, 1, 2, __X, X);
46 exc = _FP_PACK_CANONICAL(S, 1, __X);
47 if (!exc || !__FPU_TRAP_P(exc)) {
48 _FP_UNPACK_CANONICAL(S, 1, __X);
49 FP_CONV(D, S, 2, 1, X, __X);
50 exc |= _FP_PACK_CANONICAL(D, 2, X);
51 if (!exc || !__FPU_TRAP_P(exc))
52 __FP_PACK_RAW_2(D, val, X);
53 }
54 return exc;
55 }
56