Mercurial > ecos
comparison packages/language/c/libc/current/src/stdlib/abs.cxx @ 0:3111d98ba7b3 ecos-v1_1-release
Initial commit of eCos version 1.1
| author | jlarmour |
|---|---|
| date | Tue, 11 May 1999 11:16:07 +0000 |
| parents | |
| children | 443894e2e912 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:3111d98ba7b3 |
|---|---|
| 1 //=========================================================================== | |
| 2 // | |
| 3 // abs.cxx | |
| 4 // | |
| 5 // Real alternative for inline implementation of the ANSI standard | |
| 6 // abs() utility function defined in section 7.10.6.1 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 int | |
| 69 abs( int j ) CYGPRI_LIBC_WEAK_ALIAS("_abs"); | |
| 70 | |
| 71 | |
| 72 // FUNCTIONS | |
| 73 | |
| 74 int | |
| 75 _abs( int j ) | |
| 76 { | |
| 77 int retval; | |
| 78 | |
| 79 CYG_REPORT_FUNCNAMETYPE( "_abs", "returning %d" ); | |
| 80 | |
| 81 retval = (j<0) ? -j : j; | |
| 82 | |
| 83 CYG_REPORT_RETVAL( retval ); | |
| 84 | |
| 85 return retval; | |
| 86 } // _abs() | |
| 87 | |
| 88 | |
| 89 #endif // ifdef CYGPKG_LIBC | |
| 90 | |
| 91 // EOF abs.cxx |
