xref: /netbsd-src/lib/libm/arch/powerpc/fenv.c (revision 7e30e94394d0994ab9534f68a8f91665045c91ce)
1*7e30e943Schs /*	$NetBSD: fenv.c,v 1.2 2017/03/22 23:11:08 chs Exp $	*/
2161588a5Schristos 
3161588a5Schristos /*-
4161588a5Schristos  * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
5161588a5Schristos  * All rights reserved.
6161588a5Schristos  *
7161588a5Schristos  * Redistribution and use in source and binary forms, with or without
8161588a5Schristos  * modification, are permitted provided that the following conditions
9161588a5Schristos  * are met:
10161588a5Schristos  * 1. Redistributions of source code must retain the above copyright
11161588a5Schristos  *    notice, this list of conditions and the following disclaimer.
12161588a5Schristos  * 2. Redistributions in binary form must reproduce the above copyright
13161588a5Schristos  *    notice, this list of conditions and the following disclaimer in the
14161588a5Schristos  *    documentation and/or other materials provided with the distribution.
15161588a5Schristos  *
16161588a5Schristos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17161588a5Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18161588a5Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19161588a5Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20161588a5Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21161588a5Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22161588a5Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23161588a5Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24161588a5Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25161588a5Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26161588a5Schristos  * SUCH DAMAGE.
27161588a5Schristos  *
28161588a5Schristos  * $FreeBSD: head/lib/msun/powerpc/fenv.c 226415 2011-10-16 05:37:56Z das $
29161588a5Schristos  */
30161588a5Schristos #include <sys/cdefs.h>
31*7e30e943Schs __RCSID("$NetBSD: fenv.c,v 1.2 2017/03/22 23:11:08 chs Exp $");
32*7e30e943Schs 
33*7e30e943Schs #include "namespace.h"
34161588a5Schristos 
35161588a5Schristos #define	__fenv_static
36*7e30e943Schs #include <fenv.h>
37*7e30e943Schs 
38*7e30e943Schs #ifdef __weak_alias
39*7e30e943Schs __weak_alias(feclearexcept,_feclearexcept)
40*7e30e943Schs __weak_alias(fedisableexcept,_fedisableexcept)
41*7e30e943Schs __weak_alias(feenableexcept,_feenableexcept)
42*7e30e943Schs __weak_alias(fegetenv,_fegetenv)
43*7e30e943Schs __weak_alias(fegetexcept,_fegetexcept)
44*7e30e943Schs __weak_alias(fegetexceptflag,_fegetexceptflag)
45*7e30e943Schs __weak_alias(fegetround,_fegetround)
46*7e30e943Schs __weak_alias(feholdexcept,_feholdexcept)
47*7e30e943Schs __weak_alias(feraiseexcept,_feraiseexcept)
48*7e30e943Schs __weak_alias(fesetenv,_fesetenv)
49*7e30e943Schs __weak_alias(fesetexceptflag,_fesetexceptflag)
50*7e30e943Schs __weak_alias(fesetround,_fesetround)
51*7e30e943Schs __weak_alias(fetestexcept,_fetestexcept)
52*7e30e943Schs __weak_alias(feupdateenv,_feupdateenv)
53*7e30e943Schs #endif
54161588a5Schristos 
55161588a5Schristos #if defined(__GNUC_GNU_INLINE__) && !defined(__lint__)
56161588a5Schristos #error "This file must be compiled with C99 'inline' semantics"
57161588a5Schristos #endif
58161588a5Schristos 
59161588a5Schristos const fenv_t __fe_dfl_env = 0x00000000;
60161588a5Schristos 
61161588a5Schristos extern inline int feclearexcept(int __excepts);
62161588a5Schristos extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts);
63161588a5Schristos extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
64161588a5Schristos extern inline int feraiseexcept(int __excepts);
65161588a5Schristos extern inline int fetestexcept(int __excepts);
66161588a5Schristos extern inline int fegetround(void);
67161588a5Schristos extern inline int fesetround(int __round);
68161588a5Schristos extern inline int fegetenv(fenv_t *__envp);
69161588a5Schristos extern inline int feholdexcept(fenv_t *__envp);
70161588a5Schristos extern inline int fesetenv(const fenv_t *__envp);
71161588a5Schristos extern inline int feupdateenv(const fenv_t *__envp);
72*7e30e943Schs extern inline int feenableexcept(int __excepts);
73*7e30e943Schs extern inline int fedisableexcept(int __excepts);
74*7e30e943Schs extern inline int fegetexcept(void);
75