OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdlib/] [llabs.c] - Blame information for rev 455

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.