ICU-827 Move U_MAX_PTR from utypes.h to putil.h because it's a private platform macro
X-SVN-Rev: 4291
This commit is contained in:
parent
0378c92ba4
commit
fc9385706c
@ -291,4 +291,24 @@ u_getVersion(UVersionInfo versionArray);
|
|||||||
# error Unknown charset family!
|
# error Unknown charset family!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer.
|
||||||
|
* In fact, buffer sizes must not exceed 2GB so that the difference between
|
||||||
|
* the buffer limit and the buffer start can be expressed in an int32_t.
|
||||||
|
*
|
||||||
|
* The definition of U_MAX_PTR must fulfill the following conditions:
|
||||||
|
* - return the largest possible pointer greater than base
|
||||||
|
* - return a valid pointer according to the machine architecture (AS/400, 64-bit, etc.)
|
||||||
|
* - avoid wrapping around at high addresses
|
||||||
|
* - make sure that the returned pointer is not farther from base than 0x7fffffff
|
||||||
|
*
|
||||||
|
* For some architectures (like AS/400), a custom macro must be defined in platform.h.in or similar.
|
||||||
|
*
|
||||||
|
* @param base The beginning of a buffer to find the maximum offset from
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
#ifndef U_MAX_PTR
|
||||||
|
# define U_MAX_PTR(base) ((void *)(((char *)(base)+0x7fffffff)>(char *)(base) ? ((char *)(base)+0x7fffffff) : (char *)-1))
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user