summaryrefslogtreecommitdiff
path: root/lib/libc/arch/amd64/gen/signbitl.c
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2008-12-09 19:52:35 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2008-12-09 19:52:35 +0000
commit9e5337fc957e6c7535daf2a109184402a542f1ec (patch)
tree84cad8df1ca61a3ef08f4c6720f1d9f771a6fd1d /lib/libc/arch/amd64/gen/signbitl.c
parenteeeafb12487449aefa05ef31aa83d0b6e24b8a8f (diff)
- add long double signbit
- make long double versions weak aliases to double versions, on archs where long doubles are 64 bits - no need to have two finites. finite() and finitef() are non-standard 3BSD obsolete versions of isfinite. remove from libm. make them weak_alias in libc to __isfinite and __isfinitef instead. similarly make 3BSD obsolete versions of isinf, isinff, isnan, isnanf weak_aliases to C99's __isinf, __isinff, __isnan, __isnanf - bump major ok millert@
Diffstat (limited to 'lib/libc/arch/amd64/gen/signbitl.c')
-rw-r--r--lib/libc/arch/amd64/gen/signbitl.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/libc/arch/amd64/gen/signbitl.c b/lib/libc/arch/amd64/gen/signbitl.c
new file mode 100644
index 00000000000..1f9f7ab332d
--- /dev/null
+++ b/lib/libc/arch/amd64/gen/signbitl.c
@@ -0,0 +1,28 @@
+/* $OpenBSD: signbitl.c,v 1.1 2008/12/09 19:52:33 martynas Exp $ */
+/*
+ * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <machine/ieee.h>
+#include <math.h>
+
+int
+__signbitl(long double e)
+{
+ struct ieee_ext *p = (struct ieee_ext *)&e;
+
+ return p->ext_sign;
+}