J3/06-222r1 To: J3 From: Aleksandar Donev Subject: C13 - UTI 60, 62, 65: KIND arguments Date: 15-Aug-2006 --------------------- Three Unresolved Technical Issues in Clause 13 regard optional KIND arguments for the intrinsics BIT_SIZE (UTI 62, page 359), BITS_KIND (UTI 60, page 361), and LEADZ (UTI 65, page 395). The basic argument in each case is that the kind type parameter for the BITS type is of type default integer and, therefore, the result values of these functions should also be of type default integer. Result values larger than huge(0) would never occur. Reply: ----- The KIND arguments to the intrinsics BIT_SIZE, BITS_KIND and LEADZ should be removed. The LEN length type parameter for CHARACTERs is of a processor-dependent integer kind, which is the reason for providing the KIND argument to the LEN intrinsic. The KIND intrinsic does not have a KIND argument, because all intrinsic kind type parameters are default integers. As to allowing to specify the kind of the result, we do not do this in other intrinsics unless the result returned could overflow in a default integer. If the result cannot overflow, just use the INT intrinsic, as in INT(BIT_SIZE(X),KIND=i64). Finally, there are no efficiency benefits to allowing kinds other than the default. If indeed calculations are performed in a higher precision (say 64 bits when the default integer is 32-bit), the conversion is trivial and merely involves storing only the lower 32 bits of the result since the upper bits will be zero. In conclusion, unless the KIND parameter to the new BITS type is made of a processor-dependent kind, there is no reason to add KIND parameters to the above-mentioned intrinsics. Edits: ----- [Editor has allowed me to not cite line numbers here] In Chapter 13, remove the KIND= argument to BIT_SIZE, BITS_KIND, LEADZ, POPCNT, POPPAR, and TRAILZ. #EOF