|
0
|
1 //=========================================================================== |
|
|
2 // |
|
|
3 // labs.cxx |
|
|
4 // |
|
|
5 // Real alternative for inline implementation of the ANSI standard |
|
|
6 // labs() utility function defined in section 7.10.6.3 of the standard |
|
|
7 // |
|
|
8 //=========================================================================== |
|
|
9 //####COPYRIGHTBEGIN#### |
|
|
10 // |
|
|
11 // ------------------------------------------- |
|
|
12 // The contents of this file are subject to the Cygnus eCos Public License |
|
|
13 // Version 1.0 (the "License"); you may not use this file except in |
|
|
14 // compliance with the License. You may obtain a copy of the License at |
|
|
15 // http://sourceware.cygnus.com/ecos |
|
|
16 // |
|
|
17 // Software distributed under the License is distributed on an "AS IS" |
|
|
18 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
19 // License for the specific language governing rights and limitations under |
|
|
20 // the License. |
|
|
21 // |
|
|
22 // The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
23 // September 30, 1998. |
|
|
24 // |
|
|
25 // The Initial Developer of the Original Code is Cygnus. Portions created |
|
|
26 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. |
|
|
27 // ------------------------------------------- |
|
|
28 // |
|
|
29 //####COPYRIGHTEND#### |
|
|
30 //=========================================================================== |
|
|
31 //#####DESCRIPTIONBEGIN#### |
|
|
32 // |
|
|
33 // Author(s): jlarmour |
|
|
34 // Contributors: jlarmour@cygnus.co.uk |
|
|
35 // Date: 1998-02-13 |
|
|
36 // Purpose: |
|
|
37 // Description: |
|
|
38 // Usage: |
|
|
39 // |
|
|
40 //####DESCRIPTIONEND#### |
|
|
41 // |
|
|
42 //=========================================================================== |
|
|
43 |
|
|
44 // CONFIGURATION |
|
|
45 |
|
|
46 #include <pkgconf/libc.h> // Configuration header |
|
|
47 |
|
|
48 // Include the C library? |
|
|
49 #ifdef CYGPKG_LIBC |
|
|
50 |
|
|
51 // INCLUDES |
|
|
52 |
|
|
53 #include <cyg/infra/cyg_type.h> // Common type definitions and support |
|
|
54 #include <cyg/infra/cyg_trac.h> // Tracing support |
|
|
55 |
|
|
56 // We don't want the inline versions of stdlib functions defined here |
|
|
57 |
|
|
58 #ifdef CYGIMP_LIBC_STDLIB_INLINES |
|
|
59 #undef CYGIMP_LIBC_STDLIB_INLINES |
|
|
60 #endif |
|
|
61 |
|
|
62 #include <stdlib.h> // Main header for stdlib functions |
|
|
63 #include "clibincl/stdlibsupp.hxx" // Support for stdlib functions |
|
|
64 |
|
|
65 |
|
|
66 // EXPORTED SYMBOLS |
|
|
67 |
|
|
68 externC long |
|
|
69 labs( long j ) CYGPRI_LIBC_WEAK_ALIAS("_labs"); |
|
|
70 |
|
|
71 |
|
|
72 // FUNCTIONS |
|
|
73 |
|
|
74 long |
|
|
75 _labs( long j ) |
|
|
76 { |
|
|
77 long retval; |
|
|
78 |
|
|
79 CYG_REPORT_FUNCNAMETYPE( "_labs", "returning %d" ); |
|
|
80 |
|
|
81 retval = (j<0) ? -j : j; |
|
|
82 |
|
|
83 CYG_REPORT_RETVAL( retval ); |
|
|
84 |
|
|
85 return retval; |
|
|
86 } // _labs() |
|
|
87 |
|
|
88 |
|
|
89 #endif // ifdef CYGPKG_LIBC |
|
|
90 |
|
|
91 // EOF labs.cxx |