xref: /openbsd-src/lib/libc/stdlib/llabs.c (revision 60e29447380c2a7085979385eb4e985f0d44970e)
1*60e29447Sguenther /*	$OpenBSD: llabs.c,v 1.4 2016/08/14 23:18:03 guenther Exp $	*/
2a31068faSmillert 
3a31068faSmillert /*-
4a31068faSmillert  * Copyright (c) 1990 The Regents of the University of California.
5a31068faSmillert  * All rights reserved.
6a31068faSmillert  *
7a31068faSmillert  * Redistribution and use in source and binary forms, with or without
8a31068faSmillert  * modification, are permitted provided that the following conditions
9a31068faSmillert  * are met:
10a31068faSmillert  * 1. Redistributions of source code must retain the above copyright
11a31068faSmillert  *    notice, this list of conditions and the following disclaimer.
12a31068faSmillert  * 2. Redistributions in binary form must reproduce the above copyright
13a31068faSmillert  *    notice, this list of conditions and the following disclaimer in the
14a31068faSmillert  *    documentation and/or other materials provided with the distribution.
155c0d7bc8Sderaadt  * 3. Neither the name of the University nor the names of its contributors
16a31068faSmillert  *    may be used to endorse or promote products derived from this software
17a31068faSmillert  *    without specific prior written permission.
18a31068faSmillert  *
19a31068faSmillert  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20a31068faSmillert  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21a31068faSmillert  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22a31068faSmillert  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23a31068faSmillert  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24a31068faSmillert  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25a31068faSmillert  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26a31068faSmillert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27a31068faSmillert  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28a31068faSmillert  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29a31068faSmillert  * SUCH DAMAGE.
30a31068faSmillert  */
31a31068faSmillert 
32a31068faSmillert #include <stdlib.h>
33a31068faSmillert 
34c2c925deSespie long long
llabs(long long j)35c2c925deSespie llabs(long long j)
36a31068faSmillert {
37a31068faSmillert 	return (j < 0 ? -j : j);
38a31068faSmillert }
39*60e29447Sguenther 
40*60e29447Sguenther __weak_alias(qabs, llabs);
41