diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2014-06-13 10:36:45 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-06-26 05:47:55 -0400 |
commit | fb738f8544d8ceb3599598f3500f33bf6ff2fca4 (patch) | |
tree | a9c7299334e8b240c3619b2c285ec15c945f14d6 | |
parent | 91496ea9f86f55e87be78ecc88c8a6b7e3802601 (diff) |
MIPS: math-emu: Reduce code duplication.
The fix in the preceeding commit did do exactly the same thing in two
places showing some code cleanup was due.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/math-emu/ieee754.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c index cb9214da372f..8e97acbbe22c 100644 --- a/arch/mips/math-emu/ieee754.c +++ b/arch/mips/math-emu/ieee754.c | |||
@@ -38,15 +38,18 @@ | |||
38 | * Older GCC requires the inner braces for initialization of union ieee754dp's | 38 | * Older GCC requires the inner braces for initialization of union ieee754dp's |
39 | * anonymous struct member. Without an error will result. | 39 | * anonymous struct member. Without an error will result. |
40 | */ | 40 | */ |
41 | #define DPCNST(s, b, m) \ | 41 | #define xPCNST(s, b, m, ebias) \ |
42 | { \ | 42 | { \ |
43 | { \ | 43 | { \ |
44 | .sign = (s), \ | 44 | .sign = (s), \ |
45 | .bexp = (b) + DP_EBIAS, \ | 45 | .bexp = (b) + ebias, \ |
46 | .mant = (m) \ | 46 | .mant = (m) \ |
47 | } \ | 47 | } \ |
48 | } | 48 | } |
49 | 49 | ||
50 | #define DPCNST(s, b, m) \ | ||
51 | xPCNST(s, b, m, DP_EBIAS) | ||
52 | |||
50 | const union ieee754dp __ieee754dp_spcvals[] = { | 53 | const union ieee754dp __ieee754dp_spcvals[] = { |
51 | DPCNST(0, DP_EMIN - 1, 0x0000000000000ULL), /* + zero */ | 54 | DPCNST(0, DP_EMIN - 1, 0x0000000000000ULL), /* + zero */ |
52 | DPCNST(1, DP_EMIN - 1, 0x0000000000000ULL), /* - zero */ | 55 | DPCNST(1, DP_EMIN - 1, 0x0000000000000ULL), /* - zero */ |
@@ -67,18 +70,8 @@ const union ieee754dp __ieee754dp_spcvals[] = { | |||
67 | DPCNST(0, 63, 0x0000000000000ULL), /* + 1.0e63 */ | 70 | DPCNST(0, 63, 0x0000000000000ULL), /* + 1.0e63 */ |
68 | }; | 71 | }; |
69 | 72 | ||
70 | /* | ||
71 | * Older GCC requires the inner braces for initialization of union ieee754sp's | ||
72 | * anonymous struct member. Without an error will result. | ||
73 | */ | ||
74 | #define SPCNST(s, b, m) \ | 73 | #define SPCNST(s, b, m) \ |
75 | { \ | 74 | xPCNST(s, b, m, SP_EBIAS) |
76 | { \ | ||
77 | .sign = (s), \ | ||
78 | .bexp = (b) + SP_EBIAS, \ | ||
79 | .mant = (m) \ | ||
80 | } \ | ||
81 | } | ||
82 | 75 | ||
83 | const union ieee754sp __ieee754sp_spcvals[] = { | 76 | const union ieee754sp __ieee754sp_spcvals[] = { |
84 | SPCNST(0, SP_EMIN - 1, 0x000000), /* + zero */ | 77 | SPCNST(0, SP_EMIN - 1, 0x000000), /* + zero */ |