1*9c7bce54Smatt /* $NetBSD: fpsetsticky.c,v 1.4 2013/01/10 08:16:10 matt Exp $ */
24472dbe5Sbjh21
34472dbe5Sbjh21 /*-
44472dbe5Sbjh21 * Copyright (c) 1997 The NetBSD Foundation, Inc.
54472dbe5Sbjh21 * All rights reserved.
64472dbe5Sbjh21 *
74472dbe5Sbjh21 * This code is derived from software contributed to The NetBSD Foundation
84472dbe5Sbjh21 * by Neil A. Carson and Mark Brinicombe
94472dbe5Sbjh21 *
104472dbe5Sbjh21 * Redistribution and use in source and binary forms, with or without
114472dbe5Sbjh21 * modification, are permitted provided that the following conditions
124472dbe5Sbjh21 * are met:
134472dbe5Sbjh21 * 1. Redistributions of source code must retain the above copyright
144472dbe5Sbjh21 * notice, this list of conditions and the following disclaimer.
154472dbe5Sbjh21 * 2. Redistributions in binary form must reproduce the above copyright
164472dbe5Sbjh21 * notice, this list of conditions and the following disclaimer in the
174472dbe5Sbjh21 * documentation and/or other materials provided with the distribution.
184472dbe5Sbjh21 *
194472dbe5Sbjh21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
204472dbe5Sbjh21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
214472dbe5Sbjh21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
224472dbe5Sbjh21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
234472dbe5Sbjh21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
244472dbe5Sbjh21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
254472dbe5Sbjh21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
264472dbe5Sbjh21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
274472dbe5Sbjh21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
284472dbe5Sbjh21 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
294472dbe5Sbjh21 * POSSIBILITY OF SUCH DAMAGE.
304472dbe5Sbjh21 */
314472dbe5Sbjh21
324472dbe5Sbjh21 #include <sys/cdefs.h>
334472dbe5Sbjh21 #if defined(LIBC_SCCS) && !defined(lint)
34*9c7bce54Smatt __RCSID("$NetBSD: fpsetsticky.c,v 1.4 2013/01/10 08:16:10 matt Exp $");
354472dbe5Sbjh21 #endif /* LIBC_SCCS and not lint */
364472dbe5Sbjh21
375d3e8294Sthorpej #include "namespace.h"
385d3e8294Sthorpej
394472dbe5Sbjh21 #include <ieeefp.h>
404472dbe5Sbjh21 #ifdef SOFTFLOAT_FOR_GCC
414472dbe5Sbjh21 #include "softfloat-for-gcc.h"
424472dbe5Sbjh21 #endif
434472dbe5Sbjh21 #include "milieu.h"
444472dbe5Sbjh21 #include "softfloat.h"
454472dbe5Sbjh21
465d3e8294Sthorpej #ifdef __weak_alias
__weak_alias(fpsetsticky,_fpsetsticky)475d3e8294Sthorpej __weak_alias(fpsetsticky,_fpsetsticky)
485d3e8294Sthorpej #endif
495d3e8294Sthorpej
504472dbe5Sbjh21 fp_except
514472dbe5Sbjh21 fpsetsticky(fp_except except)
524472dbe5Sbjh21 {
53*9c7bce54Smatt #ifdef set_float_exception_flags
54*9c7bce54Smatt return set_float_exception_flags(except, 1);
55*9c7bce54Smatt #else
56*9c7bce54Smatt const fp_except old = float_exception_flags;
574472dbe5Sbjh21 float_exception_flags = except;
584472dbe5Sbjh21 return old;
59*9c7bce54Smatt #endif
604472dbe5Sbjh21 }
61