xref: /haiku/src/system/libroot/posix/stdlib/abs.c (revision 239222b2369c39dc52df52b0a7cdd6cc0a91bc92)
1 /*
2  * Copyright 2002-2007, Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Author:
6  * 		Daniel Reinhold, danielre@users.sf.net
7  */
8 
9 
10 #include <stdlib.h>
11 
12 
13 int
14 abs(int i)
15 {
16 	return (i < 0) ? -i : i;
17 }
18 
19 
20 long
21 labs(long i)
22 {
23 	return (i < 0) ? -i : i;
24 }
25 
26 
27 long long
28 llabs(long long i)
29 {
30 	return (i < 0) ? -i : i;
31 }
32