United States-English |
|
|
HP-UX Reference > Pportal(5)HP-UX 11i Version 3: February 2007 |
|
NAMEportal — a "window to the future" for applications DESCRIPTIONThis header file is a "window to the future" for applications. It will help you to:
In addition to the macros defined in this file, it includes the header files limits.h (see limits(5)) and inttypes.h (see inttypes(5)). The following macros are defined in sys/portal.h:
The following macros can be used for print formatting and scan formatting of values of data types that can change in size based upon the compilation flag _FILE_OFFSET_BITS. Examples of such data types are off_t and fpos_t. PRIdF64 d print formatting option for a 32-bit or 64-bit size value. PRIoF64 o print formatting option for a 32-bit or 64-bit size value. PRIxF64 x print formatting option for a 32-bit or 64-bit size value. PRIuF64 u print formatting option for a 32-bit or 64-bit size value. SCNdF64 d scan formatting option for a 32-bit or 64-bit size value. SCNoF64 o scan formatting option for a 32-bit or 64-bit size value. SCNxF64 x scan formatting option for a 32-bit or 64-bit size value. SCNuF64 u scan formatting option for a 32-bit or 64-bit size value. EXAMPLESThe SET_MASK_BIT macro in the following example will turn on the high bit in a 64-bit integer. SET_MASK_BIT(SIGN_BIT(int64_t), int64_t) The SET_MASK_BIT macro in the following example will be used to turn on all bits except the sign bit in a 32-bit integer. ~SET_MASK_BIT(SIGN_BIT(int32_t), int32_t) The SET_MASK_BIT_LOOP macro in the following example will turn on the three least significant bits of the maximum integer. int i; intmax_t mask = 0; for (i = 0; i < 3; i++) { SET_MASK_BIT_LOOP(mask, i, intmax_t); } The SIGN_BIT macro in the following example will return the position of the sign bit in a 32-bit integer. SIGN_BIT(int32_t) The SIGN_BIT_MASK macro in the following example will return a sign bit mask for a 32-bit integer. SIGN_BIT_MASK(int32_t) The SIGN_EXTEND macro in the following example will convert the 8-bit integer stored in a char data type to a 64-bit integer and correctly extend the sign. char c; int64_t i; i = SIGN_EXTEND(c, char, int64_t); The TEST_ENDIAN macro in the following example will store a 1 in endian if the compilation was big endian; otherwise, it will store a 0 in endian. int endian; TEST_ENDIAN(endian); if (endian == 0) printf("This a little endian system\n"); if (endian == 1) printf("This a big endian system\n"); |
Printable version | ||
|