source: trunk/libs/newlib/src/newlib/libc/stdlib/llabs.c @ 567

Last change on this file since 567 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.0 KB
Line 
1/*
2FUNCTION
3<<llabs>>---compute the absolute value of an long long integer.
4
5INDEX
6        llabs
7
8SYNOPSIS
9        #include <stdlib.h>
10        long long llabs(long long <[j]>);
11
12DESCRIPTION
13The <<llabs>> function computes the absolute value of the long long integer
14argument <[j]> (also called the magnitude of <[j]>).
15
16The similar function <<labs>> uses and returns <<long>> rather than
17<<long long>> values.
18
19RETURNS
20A nonnegative long long integer.
21
22PORTABILITY
23<<llabs>> is ISO 9899 (C99) compatable.
24
25No supporting OS subroutines are required.
26*/
27
28/*-
29 * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
30 * All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 *    notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 *    notice, this list of conditions and the following disclaimer in the
39 *    documentation and/or other materials provided with the distribution.
40 *
41 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 */
53
54#include <stdlib.h>
55
56long long
57llabs (long long j)
58{
59        return (j < 0 ? -j : j);
60}
Note: See TracBrowser for help on using the repository browser.