From 361847f9aca0b77a09e52cb1cbc8218132ea9b3a Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 2 Oct 2013 17:02:58 -0700 Subject: [PATCH] Fix the x86_64 fenv.h. We should clean all the fenv.h files up, but not now. I've raised bug 11050744 as a reminder. Change-Id: I640c15b0f0477ec1a7891c031860404875bbe4b5 --- libm/include/amd64/fenv.h | 40 ++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/libm/include/amd64/fenv.h b/libm/include/amd64/fenv.h index 037778e50..1dc4215af 100644 --- a/libm/include/amd64/fenv.h +++ b/libm/include/amd64/fenv.h @@ -1,6 +1,3 @@ -/* $OpenBSD: fenv.h,v 1.4 2011/05/25 21:46:49 martynas Exp $ */ -/* $NetBSD: fenv.h,v 1.1 2010/07/31 21:47:54 joerg Exp $ */ - /*- * Copyright (c) 2004-2005 David Schultz * All rights reserved. @@ -32,6 +29,14 @@ #include +/* + * This file combines the OpenBSD include/fenv.h and machine/fenv.h to fit + * the style of the other architectures (where we couldn't just take an + * upstream fenv.h and had to write our own). + */ + +__BEGIN_DECLS + /* * Each symbol representing a floating point exception expands to an integer * constant expression with values, such that bitwise-inclusive ORs of _all @@ -95,9 +100,7 @@ typedef struct { * that manage the floating-point environment, namely fesetenv() and * feupdateenv(). */ -__BEGIN_DECLS extern fenv_t __fe_dfl_env; -__END_DECLS #define FE_DFL_ENV ((const fenv_t *)&__fe_dfl_env) /* @@ -114,4 +117,31 @@ __END_DECLS */ typedef unsigned int fexcept_t; +/* C99 floating-point exception functions */ +int feclearexcept(int excepts); +int fegetexceptflag(fexcept_t *flagp, int excepts); +int fesetexceptflag(const fexcept_t *flagp, int excepts); +/* feraiseexcept does not set the inexact flag on overflow/underflow */ +int feraiseexcept(int excepts); +int fetestexcept(int excepts); + +/* C99 rounding control functions */ +int fegetround(void); +int fesetround(int round); + +/* C99 floating-point environment functions */ +int fegetenv(fenv_t *__envp); +int feholdexcept(fenv_t *__envp); +int fesetenv(const fenv_t *envp); +int feupdateenv(const fenv_t *__envp); + +#if __BSD_VISIBLE +/* Additional support functions to set/query floating point traps */ +int feenableexcept(int __mask); +int fedisableexcept(int __mask); +int fegetexcept(void); +#endif /* __BSD_VISIBLE */ + +__END_DECLS + #endif /* !_AMD64_FENV_H_ */