summaryrefslogtreecommitdiff
blob: b49107a4547c7d292c485683f33a5bca196b677c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 0244066d28838d8e7cb5680253186e036abe87f5 Mon Sep 17 00:00:00 2001
From: Zhang Le <r0bertz@gentoo.org>
Date: Sun, 13 Jun 2010 21:37:39 +0800
Subject: [PATCH] define layout for HAVE_LDOUBLE_IEEE_QUAD_LE

Signed-off-by: Zhang Le <r0bertz@gentoo.org>
---
 numpy/core/src/npymath/npy_math_private.h |   35 +++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/numpy/core/src/npymath/npy_math_private.h b/numpy/core/src/npymath/npy_math_private.h
index 5a63872..b56f916 100644
--- a/numpy/core/src/npymath/npy_math_private.h
+++ b/numpy/core/src/npymath/npy_math_private.h
@@ -361,6 +361,41 @@ do {                                                            \
     typedef npy_uint64 ldouble_man_t;
     typedef npy_uint64 ldouble_exp_t;
     typedef npy_uint32 ldouble_sign_t;
+#elif defined(HAVE_LDOUBLE_IEEE_QUAD_LE)
+    /*
+     * IEEE quad precision, Big Endian. Bit representation is
+     *          |  s  |eeeeeeeeeee|mmmmmmmm................mmmmmmm|
+     *          |1 bit|  15 bits  |            112 bits           |
+     *          |          a[1]         |           a[0]          |
+     */
+    typedef npy_uint64 IEEEl2bitsrep_part;
+
+    union IEEEl2bitsrep {
+        npy_longdouble     e;
+        IEEEl2bitsrep_part a[2];
+    };
+
+    #define LDBL_MANL_INDEX     0
+    #define LDBL_MANL_MASK      0xFFFFFFFFFFFFFFFF
+    #define LDBL_MANL_SHIFT     0
+
+    #define LDBL_MANH_INDEX     1
+    #define LDBL_MANH_MASK      0x0000FFFFFFFFFFFF
+    #define LDBL_MANH_SHIFT     0
+
+    #define LDBL_EXP_INDEX      1
+    #define LDBL_EXP_MASK       0x7FFF000000000000
+    #define LDBL_EXP_SHIFT      48
+
+    #define LDBL_SIGN_INDEX     1
+    #define LDBL_SIGN_MASK      0x8000000000000000
+    #define LDBL_SIGN_SHIFT     63
+
+    #define LDBL_NBIT           0
+
+    typedef npy_uint64 ldouble_man_t;
+    typedef npy_uint64 ldouble_exp_t;
+    typedef npy_uint32 ldouble_sign_t;
 #endif
 
 /* Get the sign bit of x. x should be of type IEEEl2bitsrep */
-- 
1.7.1