This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Contributing


On Sat, Jan 22, 2005 at 05:06:47PM +0000, Paul Brook wrote:
> On Saturday 22 January 2005 16:54, Steve Kargl wrote:
> > Gunnar write a short Fortran 77 program that tortures the
> > intrinsic that you want to implement.  Compile it with g77.
> > See what the output should be, and then start writing the
> > intrinsic.  As Paul noted, NOT is already implemented.
> > You may want to look at AND, OR, and XOR.  I've attached
> > a program that exercises AND, OR, and XOR.  Note
> > that these are the bitwise operation.  Also, check g77.info
> > for the correct usage.
> 
> Also be aware that that we already implement the iand, ior and ieor 
> intrinsics, which are very similar to those listed above.
> 

Thanks for reminding me about the F95 intrinsics.  Gunnar, this
for your benefit; Paul knows this stuff.  There are indeed 
difference between, for example, XOR and IEOR.

>From g77 info:

   XOR(I, J)

   XOR: `INTEGER' or `LOGICAL' function, the exact type being the
   result of cross-promoting the types of all the arguments.

   I: `INTEGER' or `LOGICAL'; scalar; INTENT(IN).
   J: `INTEGER' or `LOGICAL'; scalar; INTENT(IN).

   Returns value resulting from boolean exclusive-OR of pair of
   bits in each of I and J.


>From a draft of the Fortran 2003 standard:

13.7.51    IEOR (I, J)
      Description.   Performs a bitwise exclusive OR.
      Class.         Elemental function.
      Arguments.
      I              shall be of type integer.
      J              shall be of type integer with the same kind
                     type parameter as I.
      Result Characteristics. Same as I.
      Result Value.  The result has the value obtained by combining I
                     and J bit-by-bit according to the following truth
                     table:
                                         I   J   IEOR (I, J)
                                         1   1        0
                                         1   0        1
                                         0   1        1
                                         0   0        0
      The model for the interpretation of an integer value as a sequence
      of bits is in 13.3.
      Example. IEOR (1, 3) has the value 2.


-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]