xref: /freebsd/lib/libc/softfloat/fpsetmask.c (revision 559a218c9b257775fb249b67945fe4a05b7a6b9f)
138f92d0cSXin LI /* $NetBSD: fpsetmask.c,v 1.4 2008/04/28 20:23:00 martin Exp $ */
215144b0fSOlivier Houchard 
315144b0fSOlivier Houchard /*-
4*b61a5730SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
5d915a14eSPedro F. Giffuni  *
615144b0fSOlivier Houchard  * Copyright (c) 1997 The NetBSD Foundation, Inc.
715144b0fSOlivier Houchard  * All rights reserved.
815144b0fSOlivier Houchard  *
915144b0fSOlivier Houchard  * This code is derived from software contributed to The NetBSD Foundation
1015144b0fSOlivier Houchard  * by Neil A. Carson and Mark Brinicombe
1115144b0fSOlivier Houchard  *
1215144b0fSOlivier Houchard  * Redistribution and use in source and binary forms, with or without
1315144b0fSOlivier Houchard  * modification, are permitted provided that the following conditions
1415144b0fSOlivier Houchard  * are met:
1515144b0fSOlivier Houchard  * 1. Redistributions of source code must retain the above copyright
1615144b0fSOlivier Houchard  *    notice, this list of conditions and the following disclaimer.
1715144b0fSOlivier Houchard  * 2. Redistributions in binary form must reproduce the above copyright
1815144b0fSOlivier Houchard  *    notice, this list of conditions and the following disclaimer in the
1915144b0fSOlivier Houchard  *    documentation and/or other materials provided with the distribution.
2015144b0fSOlivier Houchard  *
2115144b0fSOlivier Houchard  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2215144b0fSOlivier Houchard  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2315144b0fSOlivier Houchard  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2415144b0fSOlivier Houchard  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2515144b0fSOlivier Houchard  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2615144b0fSOlivier Houchard  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2715144b0fSOlivier Houchard  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2815144b0fSOlivier Houchard  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2915144b0fSOlivier Houchard  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3015144b0fSOlivier Houchard  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3115144b0fSOlivier Houchard  * POSSIBILITY OF SUCH DAMAGE.
3215144b0fSOlivier Houchard  */
3315144b0fSOlivier Houchard 
3415144b0fSOlivier Houchard #include "namespace.h"
3515144b0fSOlivier Houchard 
3615144b0fSOlivier Houchard #include <ieeefp.h>
3715144b0fSOlivier Houchard #ifdef SOFTFLOAT_FOR_GCC
3815144b0fSOlivier Houchard #include "softfloat-for-gcc.h"
3915144b0fSOlivier Houchard #endif
4015144b0fSOlivier Houchard #include "milieu.h"
4115144b0fSOlivier Houchard #include "softfloat.h"
4215144b0fSOlivier Houchard 
4315144b0fSOlivier Houchard #ifdef __weak_alias
__weak_alias(fpsetmask,_fpsetmask)4415144b0fSOlivier Houchard __weak_alias(fpsetmask,_fpsetmask)
4515144b0fSOlivier Houchard #endif
4615144b0fSOlivier Houchard 
4715144b0fSOlivier Houchard fp_except
4815144b0fSOlivier Houchard fpsetmask(fp_except mask)
4915144b0fSOlivier Houchard {
5015144b0fSOlivier Houchard 	fp_except old;
5115144b0fSOlivier Houchard 
5215144b0fSOlivier Houchard 	old = float_exception_mask;
5315144b0fSOlivier Houchard 	float_exception_mask = mask;
5415144b0fSOlivier Houchard 	return old;
5515144b0fSOlivier Houchard }
56