Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 2003 18:50:05 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 34804 for review
Message-ID:  <200307220150.h6M1o5sp026924@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=34804

Change 34804 by peter@peter_hammer on 2003/07/21 18:50:02

	Stand C++ up in front of the firing squad please.

Affected files ...

.. //depot/projects/hammer/sys/amd64/include/ieeefp.h#5 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/include/ieeefp.h#5 (text+ko) ====

@@ -111,7 +111,7 @@
 #define	SSE_RND_OFF	13	/* rounding control offset */
 #define	SSE_FZ_OFF	15	/* flush to zero offset */
 
-#if defined(__GNUC__) && !defined(__cplusplus)
+#ifdef __GNUC__
 
 #define	__fldenv(addr)	__asm __volatile("fldenv %0" : : "m" (*(addr)))
 #define	__fnstenv(addr)	__asm __volatile("fnstenv %0" : "=m" (*(addr)))
@@ -139,7 +139,20 @@
 	unsigned short _cw;
 
 	__fnstcw(&_cw);
+#ifndef __cplusplus
 	return ((_cw & FP_RND_FLD) >> FP_RND_OFF);
+#else
+	switch ((_cw & FP_RND_FLD) >> FP_RND_OFF) {
+	case FP_RN:
+		return FP_RN;
+	case FP_RM:
+		return FP_RM;
+	case FP_RP:
+		return FP_RP;
+	case FP_RZ:
+		return FP_RZ;
+	}
+#endif
 }
 
 static __inline__ fp_rnd_t
@@ -150,7 +163,24 @@
 	fp_rnd_t _p;
 
 	__fnstcw(&_cw);
+#ifndef __cplusplus
 	_p = (_cw & FP_RND_FLD) >> FP_RND_OFF;
+#else
+	switch ((_cw & FP_RND_FLD) >> FP_RND_OFF) {
+	case FP_RN:
+		_p = FP_RN;
+		break;
+	case FP_RM:
+		_p = FP_RM;
+		break;
+	case FP_RP:
+		_p = FP_RP;
+		break;
+	case FP_RZ:
+		_p = FP_RZ;
+		break;
+	}
+#endif
 	_cw &= ~FP_RND_FLD;
 	_cw |= (_m << FP_RND_OFF) & FP_RND_FLD;
 	__fldcw(&_cw);
@@ -172,7 +202,20 @@
 	unsigned short _cw;
 
 	__fnstcw(&_cw);
+#ifndef __cplusplus
 	return ((_cw & FP_PRC_FLD) >> FP_PRC_OFF);
+#else
+	switch ((_cw & FP_PRC_FLD) >> FP_PRC_OFF) {
+	case FP_PS:
+		return FP_PS;
+	case FP_PRS:
+		return FP_PRS;
+	case FP_PD:
+		return FP_PD;
+	case FP_PE:
+		return FP_PE;
+	}
+#endif
 }
 
 static __inline__ fp_prec_t
@@ -182,7 +225,24 @@
 	fp_prec_t _p;
 
 	__fnstcw(&_cw);
+#ifndef __cplusplus
 	_p = (_cw & FP_PRC_FLD) >> FP_PRC_OFF;
+#else
+	switch ((_cw & FP_PRC_FLD) >> FP_PRC_OFF) {
+	case FP_PS:
+		_p = FP_PS;
+		break;
+	case FP_PRS:
+		_p = FP_PRS;
+		break;
+	case FP_PD:
+		_p = FP_PD;
+		break;
+	case FP_PE:
+		_p = FP_PE;
+		break;
+	}
+#endif
 	_cw &= ~FP_PRC_FLD;
 	_cw |= (_m << FP_PRC_OFF) & FP_PRC_FLD;
 	__fldcw(&_cw);
@@ -263,7 +323,7 @@
 /* Suppress prototypes in the MI header. */
 #define	_IEEEFP_INLINED_	1
 
-#else /* __GNUC__ && !__cplusplus */
+#else /* __GNUC__ */
 
 /* Augment the userland declarations */
 __BEGIN_DECLS
@@ -271,6 +331,6 @@
 extern fp_prec_t fpsetprec(fp_prec_t);
 __END_DECLS
 
-#endif /* __GNUC__ && !__cplusplus */
+#endif /* __GNUC__ */
 
 #endif /* !_MACHINE_IEEEFP_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200307220150.h6M1o5sp026924>