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__.
This commit is contained in:
Ralf Corsepius 2011-08-23 05:51:04 +00:00
parent a22abf5d17
commit 74c92a62fe
2 changed files with 11 additions and 0 deletions

View File

@ -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".

View File

@ -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