]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Softfloat/unordsf2.c
StdLib/LibC: Add software floating point library from NetBSD
[mirror_edk2.git] / StdLib / LibC / Softfloat / unordsf2.c
diff --git a/StdLib/LibC/Softfloat/unordsf2.c b/StdLib/LibC/Softfloat/unordsf2.c
new file mode 100644 (file)
index 0000000..5ba1e3a
--- /dev/null
@@ -0,0 +1,40 @@
+/* $NetBSD: unordsf2.c,v 1.1 2003/05/06 08:58:20 rearnsha Exp $ */\r
+/** @file\r
+*\r
+*  Copyright (c) 2013 - 2014, ARM Limited. All rights reserved.\r
+*\r
+*  This program and the accompanying materials\r
+*  are licensed and made available under the terms and conditions of the BSD License\r
+*  which accompanies this distribution.  The full text of the license may be found at\r
+*  http://opensource.org/licenses/bsd-license.php\r
+*\r
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+/*\r
+ * Written by Richard Earnshaw, 2003.  This file is in the Public Domain.\r
+ */\r
+\r
+#include "softfloat-for-gcc.h"\r
+#include "milieu.h"\r
+#include "softfloat.h"\r
+\r
+#include <sys/cdefs.h>\r
+#if defined(LIBC_SCCS) && !defined(lint)\r
+__RCSID("$NetBSD: unordsf2.c,v 1.1 2003/05/06 08:58:20 rearnsha Exp $");\r
+#endif /* LIBC_SCCS and not lint */\r
+\r
+flag __unordsf2(float32, float32);\r
+\r
+flag\r
+__unordsf2(float32 a, float32 b)\r
+{\r
+    /*\r
+     * The comparison is unordered if either input is a NaN.\r
+     * Test for this by comparing each operand with itself.\r
+     * We must perform both comparisons to correctly check for\r
+     * signalling NaNs.\r
+     */\r
+    return 1 ^ (float32_eq(a, a) & float32_eq(b, b));\r
+}\r