Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[sfrench/cifs-2.6.git] / arch / powerpc / math-emu / types.c
1 #include "soft-fp.h"
2 #include "double.h"
3 #include "single.h"
4
5 void
6 fp_unpack_d(long *_s, unsigned long *_f1, unsigned long *_f0,
7             long *_e, long *_c, void *val)
8 {
9         FP_DECL_D(X);
10
11         __FP_UNPACK_RAW_2(D, X, val);
12
13         _FP_UNPACK_CANONICAL(D, 2, X);
14
15         *_s = X_s;
16         *_f1 = X_f1;
17         *_f0 = X_f0;
18         *_e = X_e;
19         *_c = X_c;
20 }
21
22 int
23 fp_pack_d(void *val, long X_s, unsigned long X_f1,
24           unsigned long X_f0, long X_e, long X_c)
25 {
26         int exc;
27
28         exc = _FP_PACK_CANONICAL(D, 2, X);
29         if (!exc || !__FPU_TRAP_P(exc))
30                 __FP_PACK_RAW_2(D, val, X);
31         return exc;
32 }
33
34 int
35 fp_pack_ds(void *val, long X_s, unsigned long X_f1,
36            unsigned long X_f0, long X_e, long X_c)
37 {
38         FP_DECL_S(__X);
39         int exc;
40
41         FP_CONV(S, D, 1, 2, __X, X);
42         exc = _FP_PACK_CANONICAL(S, 1, __X);
43         if (!exc || !__FPU_TRAP_P(exc)) {
44                 _FP_UNPACK_CANONICAL(S, 1, __X);
45                 FP_CONV(D, S, 2, 1, X, __X);
46                 exc |= _FP_PACK_CANONICAL(D, 2, X);
47                 if (!exc || !__FPU_TRAP_P(exc))
48                         __FP_PACK_RAW_2(D, val, X);
49         }
50         return exc;
51 }