diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2011-08-23 05:51:04 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2011-08-23 05:51:04 +0000 |
commit | 74c92a62fe1d815b90c72587504dfd57b51ae62b (patch) | |
tree | e39a560849c2039dfbb6bd68d02361b5181cbf1b | |
parent | a22abf5d17c7d3a978f6c57ffe78de6a213e9356 (diff) | |
download | newlib-74c92a62fe1d815b90c72587504dfd57b51ae62b.zip newlib-74c92a62fe1d815b90c72587504dfd57b51ae62b.tar.gz newlib-74c92a62fe1d815b90c72587504dfd57b51ae62b.tar.bz2 |
2011-08-23 Ralf Corsépius <ralf.corsepius@rtems.org>
* libc/sys/rtems/include/limits.h: Compute SSIZE_MAX based on
__SIZE_MAX__, __SIZEOF_SIZE_T__ and __CHAR_BIT__.
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/sys/rtems/include/limits.h | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index bb89888..c8dbd7f 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2011-08-23 Ralf Corsépius <ralf.corsepius@rtems.org> + + * libc/sys/rtems/include/limits.h: Compute SSIZE_MAX based on + __SIZE_MAX__, __SIZEOF_SIZE_T__ and __CHAR_BIT__. + 2011-08-22 Ralf Corsépius <ralf.corsepius@rtems.org> * libc/string/index.c: Include <strings.h> for "index". diff --git a/newlib/libc/sys/rtems/include/limits.h b/newlib/libc/sys/rtems/include/limits.h index 13e168c..43ede04 100644 --- a/newlib/libc/sys/rtems/include/limits.h +++ b/newlib/libc/sys/rtems/include/limits.h @@ -78,7 +78,13 @@ * Invariant values */ +#ifdef __SIZE_MAX__ +#define SSIZE_MAX (__SIZE_MAX__ >> 1) +#elif defined(__SIZEOF_SIZE_T__) && defined(__CHAR_BIT__) +#define SSIZE_MAX ((1UL << (__SIZEOF_SIZE_T__ * __CHAR_BIT__ - 1)) - 1) +#else /* historic fallback, wrong in most cases */ #define SSIZE_MAX 32767 +#endif /* * Maximum Values |