1 /* 2 * Copyright (c) 2002, OpenBeOS Project. 3 * All rights reserved. 4 * Distributed under the terms of the OpenBeOS license. 5 * 6 * 7 * abs.c: 8 * implements the standard C library functions: 9 * abs, labs, llabs 10 * 11 * 12 * Author(s): 13 * Daniel Reinhold (danielre@users.sf.net) 14 * 15 */ 16 17 #include <stdlib.h> 18 19 20 int 21 abs(int i) 22 { 23 return (i < 0) ? -i : i; 24 } 25 26 27 long 28 labs(long i) 29 { 30 return (i < 0) ? -i : i; 31 } 32 33 34 long long 35 llabs(long long i) 36 { 37 return (i < 0) ? -i : i; 38 } 39 40