1*9e66e6d7Sabs /* $NetBSD: llabs.c,v 1.4 2012/06/25 22:32:45 abs Exp $ */
2e4d7c2e3Skleink
3e4d7c2e3Skleink /*-
4e4d7c2e3Skleink * Copyright (c) 1990, 1993
5e4d7c2e3Skleink * The Regents of the University of California. All rights reserved.
6e4d7c2e3Skleink *
7e4d7c2e3Skleink * Redistribution and use in source and binary forms, with or without
8e4d7c2e3Skleink * modification, are permitted provided that the following conditions
9e4d7c2e3Skleink * are met:
10e4d7c2e3Skleink * 1. Redistributions of source code must retain the above copyright
11e4d7c2e3Skleink * notice, this list of conditions and the following disclaimer.
12e4d7c2e3Skleink * 2. Redistributions in binary form must reproduce the above copyright
13e4d7c2e3Skleink * notice, this list of conditions and the following disclaimer in the
14e4d7c2e3Skleink * documentation and/or other materials provided with the distribution.
15eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
16e4d7c2e3Skleink * may be used to endorse or promote products derived from this software
17e4d7c2e3Skleink * without specific prior written permission.
18e4d7c2e3Skleink *
19e4d7c2e3Skleink * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20e4d7c2e3Skleink * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21e4d7c2e3Skleink * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22e4d7c2e3Skleink * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23e4d7c2e3Skleink * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24e4d7c2e3Skleink * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25e4d7c2e3Skleink * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26e4d7c2e3Skleink * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27e4d7c2e3Skleink * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28e4d7c2e3Skleink * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29e4d7c2e3Skleink * SUCH DAMAGE.
30e4d7c2e3Skleink */
31e4d7c2e3Skleink
32e4d7c2e3Skleink #include <sys/cdefs.h>
33e4d7c2e3Skleink #if defined(LIBC_SCCS) && !defined(lint)
34e4d7c2e3Skleink #if 0
35e4d7c2e3Skleink static char sccsid[] = "from: @(#)labs.c 8.1 (Berkeley) 6/4/93";
36e4d7c2e3Skleink #else
37*9e66e6d7Sabs __RCSID("$NetBSD: llabs.c,v 1.4 2012/06/25 22:32:45 abs Exp $");
38e4d7c2e3Skleink #endif
39e4d7c2e3Skleink #endif /* LIBC_SCCS and not lint */
40e4d7c2e3Skleink
41e4d7c2e3Skleink #include "namespace.h"
42e4d7c2e3Skleink #include <stdlib.h>
43e4d7c2e3Skleink
44e4d7c2e3Skleink #ifdef __weak_alias
__weak_alias(llabs,_llabs)45e4d7c2e3Skleink __weak_alias(llabs, _llabs)
46e4d7c2e3Skleink #endif
47e4d7c2e3Skleink
484c3c49aeSkleink /* LONGLONG */
49e4d7c2e3Skleink long long int
50*9e66e6d7Sabs llabs(long long int j)
51e4d7c2e3Skleink {
52e4d7c2e3Skleink return (j < 0 ? -j : j);
53e4d7c2e3Skleink }
54