summaryrefslogtreecommitdiff
path: root/gcc/real.h
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-05-27 19:36:39 +0000
committerRichard Stallman <rms@gnu.org>1992-05-27 19:36:39 +0000
commitf92505550c948846bfbfdddea6d5aa154b86cfa6 (patch)
tree76579e1778bb964b1a9e8a195a16ef5bf09689ee /gcc/real.h
parent10f4f53f434aa4d421e9113197e7c1d71522d8a5 (diff)
downloadgcc-f92505550c948846bfbfdddea6d5aa154b86cfa6.tar.gz
*** empty log message ***
From-SVN: r1097
Diffstat (limited to 'gcc/real.h')
-rw-r--r--gcc/real.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/real.h b/gcc/real.h
index 3f8c3aa5fb0..571eb5d453c 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -67,6 +67,34 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define REAL_IS_NOT_DOUBLE
#endif
+#if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
+
+/* Convert a type `double' value in host format first to a type `float'
+ value in host format and then to a single type `long' value which
+ is the bitwise equivalent of the `float' value. */
+#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \
+do { float f = (float) (IN); \
+ (OUT) = *(long *) &f; \
+ } while (0)
+
+/* Convert a type `double' value in host format to a pair of type `long'
+ values which is its bitwise equivalent, but put the two words into
+ proper word order for the target. */
+#if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
+#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \
+do { REAL_VALUE_TYPE in = (IN); /* Make sure it's not in a register. */\
+ (OUT)[0] = ((long *) &in)[0]; \
+ (OUT)[1] = ((long *) &in)[1]; \
+ } while (0)
+#else
+#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \
+do { REAL_VALUE_TYPE in = (IN); /* Make sure it's not in a register. */\
+ (OUT)[1] = ((long *) &in)[0]; \
+ (OUT)[0] = ((long *) &in)[1]; \
+ } while (0)
+#endif
+#endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
+
/* Compare two floating-point values for equality. */
#ifndef REAL_VALUES_EQUAL
#define REAL_VALUES_EQUAL(x,y) ((x) == (y))