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