------- Comment #2 from w6ws at earthlink dot net 2008-11-27 19:32 ------- Tobias, Steven,
If you would like to usurp this request and use it to implement the complete set of F2008 bit intrinsics, please feel free to do so. For completeness, one other HPF bit intrinsic is ILEN - which counts the number of bits needed to represent an integer. This is not in the F2008 draft, but is occasionally useful. A few comments on the draft F2008 intrinsics: DSHIFTL/DSHIFTR - Cray-1 intrinsics. Occasionally handy. Represented the hardware vector "snake" instruction. SHIFTA - Lots of systems have this instruction in hardware, but not the Cray-1. So it went into the Cray compilers somewhat later. SHIFTL/SHIFTR - Cray-1 intrinsics. Better than ISHFT because the compiler always knows which shift instruction to generate. MASKL/MASKR - Shades of the MASK intrinsic on 60-bit CDC systems, which represented a hardware instruction. MERGE_BITS - On the Cray-1, it was called CSMG. Hardware instruction. One final instrinsic: IBCHNG. This was part of the old "Industrial Real-Time Fortran" Standard. IBCHNG allows the caller to 'flip' a specific bit to its complement. The IRTF bit intrinsics were the basis for the Milspec-1753 bit intrinsics, and then F90. But somehow IBCHNG got lost along the way. Nonetheless, a number of compilers (ifort, cray, sun, sgi, probably ibm, etc) also implement IBCHNG. (We could talk about the IRTF ISHL (logical shift), ISHA (arithmetic shift), and ISHC (circular shift) which are also implemented in some compilers. But since the F90 ISHFT and ISHFTC, and F2008 SHIFTA cover these cases in a Standard-conforming way, I would not recommend implementing them in gfortran.) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38282