summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/ieeefp.h
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2008-01-09 13:35:31 +0000
committerbde <bde@FreeBSD.org>2008-01-09 13:35:31 +0000
commit35b2cbed50bbcfda032aaf47dfbfcc89690d2f32 (patch)
tree8f7baf19598383c64f24d309a0cbfe501d73eb0e /sys/amd64/include/ieeefp.h
parentb52cfc10cb3db71f292b38c8ae859dc6a17c9385 (diff)
downloadFreeBSD-src-35b2cbed50bbcfda032aaf47dfbfcc89690d2f32.zip
FreeBSD-src-35b2cbed50bbcfda032aaf47dfbfcc89690d2f32.tar.gz
Fix some style bugs (mainly, use explicit shifts when accessing bit-fields
even if the shift count happens to be 0, sort declarations, and spell __inline normally).
Diffstat (limited to 'sys/amd64/include/ieeefp.h')
-rw-r--r--sys/amd64/include/ieeefp.h62
1 files changed, 31 insertions, 31 deletions
diff --git a/sys/amd64/include/ieeefp.h b/sys/amd64/include/ieeefp.h
index 4fbbd09..e78a108 100644
--- a/sys/amd64/include/ieeefp.h
+++ b/sys/amd64/include/ieeefp.h
@@ -121,13 +121,13 @@ typedef enum {
#define SSE_RND_OFF 13 /* rounding control offset */
#define SSE_FZ_OFF 15 /* flush to zero offset */
-#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__) \
+#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) \
&& !defined(__cplusplus)
-#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr)))
-#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr)))
#define __fldcw(addr) __asm __volatile("fldcw %0" : : "m" (*(addr)))
+#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr)))
#define __fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr)))
+#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr)))
#define __fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr)))
#define __ldmxcsr(addr) __asm __volatile("ldmxcsr %0" : : "m" (*(addr)))
#define __stmxcsr(addr) __asm __volatile("stmxcsr %0" : "=m" (*(addr)))
@@ -143,7 +143,7 @@ typedef enum {
* merge the two together. I think.
*/
-static __inline__ fp_rnd_t
+static __inline fp_rnd_t
__fpgetround(void)
{
unsigned short _cw;
@@ -152,11 +152,11 @@ __fpgetround(void)
return ((_cw & FP_RND_FLD) >> FP_RND_OFF);
}
-static __inline__ fp_rnd_t
+static __inline fp_rnd_t
__fpsetround(fp_rnd_t _m)
{
unsigned short _cw;
- unsigned int _mxcsr;
+ unsigned _mxcsr;
fp_rnd_t _p;
__fnstcw(&_cw);
@@ -176,7 +176,7 @@ __fpsetround(fp_rnd_t _m)
* There is no equivalent SSE mode or control.
*/
-static __inline__ fp_prec_t
+static __inline fp_prec_t
__fpgetprec(void)
{
unsigned short _cw;
@@ -185,11 +185,11 @@ __fpgetprec(void)
return ((_cw & FP_PRC_FLD) >> FP_PRC_OFF);
}
-static __inline__ fp_prec_t
+static __inline fp_prec_t
__fpsetprec(fp_rnd_t _m)
{
- unsigned short _cw;
fp_prec_t _p;
+ unsigned short _cw;
__fnstcw(&_cw);
_p = (_cw & FP_PRC_FLD) >> FP_PRC_OFF;
@@ -205,53 +205,53 @@ __fpsetprec(fp_rnd_t _m)
* means disable for x87 and SSE, but for fp*mask() it means enable.
*/
-static __inline__ fp_except_t
+static __inline fp_except_t
__fpgetmask(void)
{
unsigned short _cw;
__fnstcw(&_cw);
- return ((~_cw) & FP_MSKS_FLD);
+ return ((~_cw & FP_MSKS_FLD) >> FP_MSKS_OFF);
}
-static __inline__ fp_except_t
+static __inline fp_except_t
__fpsetmask(fp_except_t _m)
{
- unsigned short _cw;
- unsigned int _mxcsr;
fp_except_t _p;
+ unsigned _mxcsr;
+ unsigned short _cw;
__fnstcw(&_cw);
- _p = (~_cw) & FP_MSKS_FLD;
+ _p = (~_cw & FP_MSKS_FLD) >> FP_MSKS_OFF;
_cw &= ~FP_MSKS_FLD;
- _cw |= (~_m) & FP_MSKS_FLD;
+ _cw |= (~_m >> FP_MSKS_OFF) & FP_MSKS_FLD;
__fldcw(&_cw);
__stmxcsr(&_mxcsr);
/* XXX should we clear non-ieee SSE_DAZ_FLD and SSE_FZ_FLD ? */
_mxcsr &= ~SSE_MSKS_FLD;
- _mxcsr |= ((~_m) << SSE_MSKS_OFF) & SSE_MSKS_FLD;
+ _mxcsr |= (~_m << SSE_MSKS_OFF) & SSE_MSKS_FLD;
__ldmxcsr(&_mxcsr);
return (_p);
}
-static __inline__ fp_except_t
+static __inline fp_except_t
__fpgetsticky(void)
{
- unsigned short _sw;
- unsigned int _mxcsr;
fp_except_t _ex;
+ unsigned _mxcsr;
+ unsigned short _sw;
__fnstsw(&_sw);
- _ex = _sw & FP_STKY_FLD;
+ _ex = (_sw & FP_STKY_FLD) >> FP_STKY_OFF;
__stmxcsr(&_mxcsr);
- _ex |= _mxcsr & SSE_STKY_FLD;
+ _ex |= (_mxcsr & SSE_STKY_FLD) >> SSE_STKY_OFF;
return (_ex);
}
-#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE__ && !__cplusplus */
+#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE && !__cplusplus */
-#if !defined(__IEEEFP_NOINLINES__) && !defined(__cplusplus) \
- && defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__)
+#if !defined(__IEEEFP_NOINLINES__) && !defined(__cplusplus) && \
+ defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE)
#define fpgetround() __fpgetround()
#define fpsetround(_m) __fpsetround(_m)
@@ -264,16 +264,16 @@ __fpgetsticky(void)
/* Suppress prototypes in the MI header. */
#define _IEEEFP_INLINED_ 1
-#else /* !(!__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM
- && __CC_SUPPORTS___INLINE__) */
+#else /* !(!__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM &&
+ __CC_SUPPORTS___INLINE) */
/* Augment the userland declarations. */
__BEGIN_DECLS
-extern fp_prec_t fpgetprec(void);
-extern fp_prec_t fpsetprec(fp_prec_t);
+fp_prec_t fpgetprec(void);
+fp_prec_t fpsetprec(fp_prec_t);
__END_DECLS
-#endif /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM
- && __CC_SUPPORTS___INLINE__ */
+#endif /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM &&
+ __CC_SUPPORTS___INLINE */
#endif /* !_MACHINE_IEEEFP_H_ */
OpenPOWER on IntegriCloud