summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2002-06-17 19:15:46 +0000
committerderaadt <deraadt@openbsd.org>2002-06-17 19:15:46 +0000
commit7c24c3e8f4c5ec2671328c0e0ce067fd51e78576 (patch)
tree8f2b1b133bd8cc4e0ee0e3c275206c36034842b1 /lib/libc
parent- make user ioctl's available via gprio.h (diff)
downloadwireguard-openbsd-7c24c3e8f4c5ec2671328c0e0ce067fd51e78576.tar.xz
wireguard-openbsd-7c24c3e8f4c5ec2671328c0e0ce067fd51e78576.zip
make fabs use asm, and license repair
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/arch/powerpc/gen/fabs.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/lib/libc/arch/powerpc/gen/fabs.c b/lib/libc/arch/powerpc/gen/fabs.c
index e9e8510399d..e34dfdf7b2b 100644
--- a/lib/libc/arch/powerpc/gen/fabs.c
+++ b/lib/libc/arch/powerpc/gen/fabs.c
@@ -1,9 +1,35 @@
+/* $OpenBSD: fabs.c,v 1.2 2002/06/17 19:15:46 deraadt Exp $ */
+
+/*
+ * Copyright (c) 2002 Theo de Raadt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <math.h>
+
double
-fabs(double val)
+fabs(double x)
{
- if (val > 0) {
- return val;
- } else {
- return -val;
- }
+ __asm__ __volatile("fabs %0,%1" : "=f"(x) : "f"(x));
+ return (x);
}