To: J3 07-313
From: Bill Long
Subject: Missing bits intrinsics - 1
Date: 2007 October 26
References: J3/07-007r3, WG5/N1695
Discussion
Part 1 of paper N1695 contains the list of new intrinsics related to
bit manipulation that were to be retained in the Fortran 2008 draft.
Two of the intrinsics, maskl and maskr, are missing in 07-007r3. In
addition, there is an error in the Example for shifta. Edits are
provided to fix these problems.
Edits to 07-007r3:
[345:LOGICAL+] Following the entry for LOGICAL in Table 13.1 Standard
generic intrinsic procedure summary, add two entries:
"MASKL (I [,KIND]) E Left justified mask.
MASKR (I [,KIND]) E Right justified mask."
[393:29+] After 13.7.107 LOGICAL, add two new function descriptions
(largely copied from 07-007r2 [411:19 - 412:7]):
"13.7.107+1 MASKL (I [,KIND])
Description. Left justified mask.
Class. Elemental function.
Arguments.
I shall be of type integer. It shall be nonnegative and
less than or equal to BIT_SIZE(M) where M has the kind
type parameter of the result.
KIND (optional) shall be a scalar integer initialization expression.
Result Characteristics. Integer. If KIND is present, the kind type
parameter is that specified by the value of KIND; otherwise, the kind
type parameter is that of default integer type.
Result value. The result has the leftmost I bits set to 1 and the
remaining bits set to 0. The model for the interpretation of an
integer value as a sequence of bits is in 13.3.
Example. MASKL(3) has the value SHIFTL(7, BIT_SIZE(0)-3).
13.7.107+2 MASKR (I [,KIND])
Description. Right justified mask.
Class. Elemental function.
Arguments.
I shall be of type integer. It shall be nonnegative and
less than or equal to BIT_SIZE(M) where M has the kind
type parameter of the result.
KIND (optional) shall be a scalar integer initialization expression.
Result Characteristics. Integer. If KIND is present, the kind type
parameter is that specified by the value of KIND; otherwise, the kind
type parameter is that of default integer type.
Result value. The result has the rightmost I bits set to 1 and the
remaining bits set to 0. The model for the interpretation of an
integer value as a sequence of bits is in 13.3.
Example. MASKR(3) has the value 7."
[417:1] In the Example section of 13.7.153 SHIFTA, the second argument
to the IBSET intrinsic is not correct. Replace the example with:
"Example. SHIFTA(SHIFTL(1,BIT_SIZE(0)-1),3) is equal to MASKL(3)."