]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/StdLib/Xabs.c
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / LibC / StdLib / Xabs.c
CommitLineData
2aa62f2b 1/** @file\r
2 The abs, labs, and llabs functions compute the absolute value of an integer j.\r
3 If the result cannot be represented, the behavior is undefined.\r
4\r
5 The abs, labs, and llabs, functions return the absolute value of their\r
6 parameter.\r
7\r
8 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
9 This program and the accompanying materials are licensed and made available under\r
10 the terms and conditions of the BSD License that accompanies this distribution.\r
11 The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php.\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16**/\r
17#include <LibConfig.h>\r
18#include <sys/EfiCdefs.h>\r
19\r
20int\r
21abs(int j)\r
22{\r
23 return(j < 0 ? -j : j);\r
24}\r
25\r
26long\r
27labs(long j)\r
28{\r
29 return(j < 0 ? -j : j);\r
30}\r
31\r
32long long\r
33llabs(long long j)\r
34{\r
35 return (j < 0 ? -j : j);\r
36}\r