]>
Commit | Line | Data |
---|---|---|
3352b62b N |
1 | /* $NetBSD: fpsetround.c,v 1.4 2013/01/10 08:16:10 matt Exp $ */\r |
2 | \r | |
3 | /*-\r | |
4 | * Copyright (c) 1997 The NetBSD Foundation, Inc.\r | |
5 | * All rights reserved.\r | |
6 | *\r | |
7 | * This code is derived from software contributed to The NetBSD Foundation\r | |
8 | * by Neil A. Carson and Mark Brinicombe\r | |
9 | *\r | |
10 | * Redistribution and use in source and binary forms, with or without\r | |
11 | * modification, are permitted provided that the following conditions\r | |
12 | * are met:\r | |
13 | * 1. Redistributions of source code must retain the above copyright\r | |
14 | * notice, this list of conditions and the following disclaimer.\r | |
15 | * 2. Redistributions in binary form must reproduce the above copyright\r | |
16 | * notice, this list of conditions and the following disclaimer in the\r | |
17 | * documentation and/or other materials provided with the distribution.\r | |
18 | *\r | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\r | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\r | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\r | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r | |
29 | * POSSIBILITY OF SUCH DAMAGE.\r | |
30 | */\r | |
31 | \r | |
32 | #include <sys/cdefs.h>\r | |
33 | #if defined(LIBC_SCCS) && !defined(lint)\r | |
34 | __RCSID("$NetBSD: fpsetround.c,v 1.4 2013/01/10 08:16:10 matt Exp $");\r | |
35 | #endif /* LIBC_SCCS and not lint */\r | |
36 | \r | |
37 | #include "namespace.h"\r | |
38 | \r | |
39 | #include <ieeefp.h>\r | |
40 | #ifdef SOFTFLOAT_FOR_GCC\r | |
41 | #include "softfloat-for-gcc.h"\r | |
42 | #endif\r | |
43 | #include "milieu.h"\r | |
44 | #include "softfloat.h"\r | |
45 | \r | |
46 | #ifdef __weak_alias\r | |
47 | __weak_alias(fpsetround,_fpsetround)\r | |
48 | #endif\r | |
49 | \r | |
50 | fp_rnd\r | |
51 | fpsetround(fp_rnd rnd_dir)\r | |
52 | {\r | |
53 | #ifdef set_float_rounding_mode\r | |
54 | return set_float_rounding_mode(rnd_dir);\r | |
55 | #else\r | |
56 | const fp_rnd old = float_rounding_mode;\r | |
57 | float_rounding_mode = rnd_dir;\r | |
58 | return old;\r | |
59 | #endif\r | |
60 | }\r |