diff options
author | Rob Landley <rob@landley.net> | 2014-05-06 06:14:20 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-05-06 06:14:20 -0500 |
commit | 30e28cf7e166cf54b3a2a4fea5e6e134b5968812 (patch) | |
tree | 8d080160009d3ab7415de5d3c7462009378b5ac9 /lib/portability.h | |
parent | 4c2bd6277d5966ea7ef7d59a34838066b5c130eb (diff) | |
download | toybox-30e28cf7e166cf54b3a2a4fea5e6e134b5968812.tar.gz |
Use compiler built-in macros to determine if argument parsing can use double or float for FLOAT arguments. (I.E. whether double fits in a long's memory.) Check in a way that the macros not being defined just gives us the shorter one.
Diffstat (limited to 'lib/portability.h')
-rw-r--r-- | lib/portability.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/portability.h b/lib/portability.h index 099f3215..1d540acf 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -148,7 +148,8 @@ int clearenv(void); #define SWAP_LE64(x) (x) #endif -#if defined(__APPLE__) || defined(__ANDROID__) || (defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 10) +#if defined(__APPLE__) || defined(__ANDROID__) \ + || (defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 10) ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream); ssize_t getline(char **lineptr, size_t *n, FILE *stream); #endif @@ -163,3 +164,11 @@ ssize_t getline(char **lineptr, size_t *n, FILE *stream); #ifndef O_NOFOLLOW #define O_NOFOLLOW 0 #endif + +#if defined(__SIZEOF_DOUBLE__) && defined(__SIZEOF_LONG__) \ + && __SIZEOF_DOUBLE__ <= __SIZEOF_LONG__ +typedef double FLOAT; +#else +typedef float FLOAT; +#endif + |