Mercurial > ecos-v2_0-branch
comparison packages/language/c/libc/stdlib/current/include/abs.inl @ 115:6ed91473a1cd ecos-sw-2000-08-21
Merge from eCos master repository on 2000-08-21-22:40:54-BST
| author | jlarmour |
|---|---|
| date | Fri, 25 Aug 2000 17:32:38 +0000 |
| parents | |
| children | e0c0827131d1 |
comparison
equal
deleted
inserted
replaced
| 114:5ad2b71d525e | 115:6ed91473a1cd |
|---|---|
| 1 #ifndef CYGONCE_LIBC_STDLIB_ABS_INL | |
| 2 #define CYGONCE_LIBC_STDLIB_ABS_INL | |
| 3 /*=========================================================================== | |
| 4 // | |
| 5 // abs.inl | |
| 6 // | |
| 7 // Inline implementations for the ISO standard utility functions | |
| 8 // abs() and labs() defined in section 7.10 of the standard | |
| 9 // | |
| 10 //=========================================================================== | |
| 11 //####COPYRIGHTBEGIN#### | |
| 12 // | |
| 13 // ------------------------------------------- | |
| 14 // The contents of this file are subject to the Red Hat eCos Public License | |
| 15 // Version 1.1 (the "License"); you may not use this file except in | |
| 16 // compliance with the License. You may obtain a copy of the License at | |
| 17 // http://www.redhat.com/ | |
| 18 // | |
| 19 // Software distributed under the License is distributed on an "AS IS" | |
| 20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 21 // License for the specific language governing rights and limitations under | |
| 22 // the License. | |
| 23 // | |
| 24 // The Original Code is eCos - Embedded Configurable Operating System, | |
| 25 // released September 30, 1998. | |
| 26 // | |
| 27 // The Initial Developer of the Original Code is Red Hat. | |
| 28 // Portions created by Red Hat are | |
| 29 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. | |
| 30 // All Rights Reserved. | |
| 31 // ------------------------------------------- | |
| 32 // | |
| 33 //####COPYRIGHTEND#### | |
| 34 //=========================================================================== | |
| 35 //#####DESCRIPTIONBEGIN#### | |
| 36 // | |
| 37 // Author(s): jlarmour | |
| 38 // Contributors: | |
| 39 // Date: 2000-04-28 | |
| 40 // Purpose: | |
| 41 // Description: | |
| 42 // Usage: Do not include this file directly - include <stdlib.h> instead | |
| 43 // | |
| 44 //####DESCRIPTIONEND#### | |
| 45 // | |
| 46 //=========================================================================*/ | |
| 47 | |
| 48 /* INCLUDES */ | |
| 49 | |
| 50 #include <cyg/infra/cyg_trac.h> /* Tracing support */ | |
| 51 | |
| 52 /* FUNCTION PROTOTYPES */ | |
| 53 | |
| 54 #ifdef __cplusplus | |
| 55 extern "C" { | |
| 56 #endif | |
| 57 | |
| 58 extern int | |
| 59 abs( int /* val */ ) __attribute__((__const__)); | |
| 60 | |
| 61 extern long | |
| 62 labs( long /* val */ ) __attribute__((__const__)); | |
| 63 | |
| 64 #ifdef __cplusplus | |
| 65 } /* extern "C" */ | |
| 66 #endif | |
| 67 | |
| 68 /* INLINE FUNCTIONS */ | |
| 69 | |
| 70 #ifndef CYGPRI_LIBC_STDLIB_ABS_INLINE | |
| 71 # define CYGPRI_LIBC_STDLIB_ABS_INLINE extern __inline__ | |
| 72 #endif | |
| 73 | |
| 74 CYGPRI_LIBC_STDLIB_ABS_INLINE 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 CYGPRI_LIBC_STDLIB_ABS_INLINE long | |
| 89 labs( long __j ) | |
| 90 { | |
| 91 long __retval; | |
| 92 | |
| 93 CYG_REPORT_FUNCNAMETYPE( "abs", "returning %ld" ); | |
| 94 | |
| 95 __retval = (__j<0) ? -__j : __j; | |
| 96 | |
| 97 CYG_REPORT_RETVAL( __retval ); | |
| 98 | |
| 99 return __retval; | |
| 100 } /* labs() */ | |
| 101 | |
| 102 | |
| 103 #endif /* CYGONCE_LIBC_STDLIB_ABS_INL multiple inclusion protection */ | |
| 104 | |
| 105 /* EOF abs.inl */ |
