Changeset 52f85e0 for src/libcfa/stdlib.c
- Timestamp:
- Feb 10, 2016, 3:57:00 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 6ba0659, cce7872
- Parents:
- bd85400
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/stdlib.c
rbd85400 r52f85e0 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Feb 5 15:41:24201613 // Update Count : 1 2812 // Last Modified On : Wed Feb 10 15:45:56 2016 13 // Update Count : 140 14 14 // 15 15 … … 23 23 #include <string.h> // memset 24 24 #include <malloc.h> // malloc_usable_size 25 #include <stdio.h>26 25 #include <math.h> // fabsf, fabs, fabsl 27 26 #include <complex.h> // _Complex_I, cabsf, cabs, cabsl … … 106 105 long int ato( const char * ptr ) { 107 106 long int li; 108 if ( sscanf( ptr, "%ld", &li ) == EOF ) {} ;// check return code107 if ( sscanf( ptr, "%ld", &li ) == EOF ) {} // check return code 109 108 return li; 110 109 } 111 110 unsigned long int ato( const char * ptr ) { 112 111 unsigned long int uli; 113 if ( sscanf( ptr, "%lu", &uli ) == EOF ) {} ;// check return code112 if ( sscanf( ptr, "%lu", &uli ) == EOF ) {} // check return code 114 113 return uli; 115 114 } 116 115 long long int ato( const char * ptr ) { 117 116 long long int lli; 118 if ( sscanf( ptr, "%lld", &lli ) == EOF ) {} ;// check return code117 if ( sscanf( ptr, "%lld", &lli ) == EOF ) {} // check return code 119 118 return lli; 120 119 } 121 120 unsigned long long int ato( const char * ptr ) { 122 121 unsigned long long int ulli; 123 if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {} ;// check return code122 if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {} // check return code 124 123 return ulli; 125 124 } 126 125 float ato( const char * ptr ) { 127 126 float f; 128 if ( sscanf( ptr, "%f", &f ) == EOF ) {} ;// check return code127 if ( sscanf( ptr, "%f", &f ) == EOF ) {} // check return code 129 128 return f; 130 129 } 131 130 double ato( const char * ptr ) { 132 131 double d; 133 if ( sscanf( ptr, "%lf", &d ) == EOF ) {} ;// check return code132 if ( sscanf( ptr, "%lf", &d ) == EOF ) {} // check return code 134 133 return d; 135 134 } 136 135 long double ato( const char * ptr ) { 137 136 long double ld; 138 printf( "FRED " ); 139 if ( sscanf( ptr, "%.32Lf", &ld ) == EOF ) {}; // check return code 137 if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {} // check return code 140 138 return ld; 141 139 } 142 140 float _Complex ato( const char * ptr ) { 143 141 float re, im; 144 if ( sscanf( ptr, "%g%g ", &re, &im ) == EOF ) {};// check return code142 if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {} // check return code 145 143 return re + im * _Complex_I; 146 144 } 147 145 double _Complex ato( const char * ptr ) { 148 146 double re, im; 149 if ( sscanf( ptr, "% .16lg%.16lg", &re, &im ) == EOF ) {};// check return code147 if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {} // check return code 150 148 return re + im * _Complex_I; 151 149 } 152 150 long double _Complex ato( const char * ptr ) { 153 151 long double re, im; 154 if ( sscanf( ptr, "% .32Lg%.32Lg", &re, &im ) == EOF ) {};// check return code152 if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {} // check return code 155 153 return re + im * _Complex_I; 156 154 }
Note: See TracChangeset
for help on using the changeset viewer.