Re: [CHALLENGE] finding rightmost zero bit



Bart Vandewoestyne wrote:
> On 2005-08-29, glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx> wrote:
>>
>> if(iand(j,Z'AAAAAAAA).NE.0) pos=pos+1
>> if(iand(j,Z'CCCCCCCC).NE.0) pos=pos+2
>> if(iand(j,Z'F0F0F0F0).NE.0) pos=pos+4
>> if(iand(j,Z'FF00FF00).NE.0) pos=pos+8
>> if(iand(j,Z'FFFF0000).NE.0) pos=pos+16
>
> This appears to be not F-compliant. Glen, can you make your
> solution conform to the F-syntax? I don't know how I should
> translate the Z'AAAAAA and stuff to F as I don't know what that
> syntax means...

Does F allow BOZ constants at all? The above are standard
compliant BOZ constants anyway: BOZ constants are required
to have a delimiter after the last digit of the literal as in the
following.

if(iand(j,Z'AAAAAAAA').NE.0) pos=pos+1
if(iand(j,Z'CCCCCCCC').NE.0) pos=pos+2
if(iand(j,Z'F0F0F0F0').NE.0) pos=pos+4
if(iand(j,Z'FF00FF00').NE.0) pos=pos+8
if(iand(j,Z'FFFF0000').NE.0) pos=pos+16

The delimiter can be either a quote or an apostrophe, but must
be the same one on both sidces of the digits of course.

In addition, until F2003 is implemented, BOZ constants may
only appear in DATA statements. In F2003, they may appear
as actual arguments in type conversion intrinsic functions.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


.