]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/StdLib/Xabs.c
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / LibC / StdLib / Xabs.c
diff --git a/StdLib/LibC/StdLib/Xabs.c b/StdLib/LibC/StdLib/Xabs.c
new file mode 100644 (file)
index 0000000..1b28985
--- /dev/null
@@ -0,0 +1,36 @@
+/** @file\r
+  The abs, labs, and llabs functions compute the absolute value of an integer j.\r
+  If the result cannot be represented, the behavior is undefined.\r
+\r
+  The abs, labs, and llabs, functions return the absolute value of their\r
+  parameter.\r
+\r
+  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  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
+#include  <LibConfig.h>\r
+#include  <sys/EfiCdefs.h>\r
+\r
+int\r
+abs(int j)\r
+{\r
+  return(j < 0 ? -j : j);\r
+}\r
+\r
+long\r
+labs(long j)\r
+{\r
+  return(j < 0 ? -j : j);\r
+}\r
+\r
+long long\r
+llabs(long long j)\r
+{\r
+  return (j < 0 ? -j : j);\r
+}\r