Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!inria!imag!jerraya From: jerraya@imag.UUCP Newsgroups: comp.lang.fortran Subject: Re:FORTRAN-77 XLA PLUS BITWISE OPERATORS Message-ID: <1731@imag.UUCP> Date: Sun, 19-Apr-87 12:33:03 EST Article-I.D.: imag.1731 Posted: Sun Apr 19 12:33:03 1987 Date-Received: Mon, 20-Apr-87 01:43:19 EST Reply-To: jerraya@imag.UUCP (Ahmed JERRAYA) Distribution: world Organization: IMAG, University of Grenoble, France Lines: 36 in article <214@homxb.UUCP>, cjn@homxb.UUCP says: > Posted: Fri Apr 10 15:15:14 1987 > > ------------------------------------------------ > Penn State Univ. has two 3b-15 computers with FORTRAN-77 XLA PLUS. > They would like to write fortran programs capable of bitwise operations, > but are unusre how to go about it. Since I have little knowledge of > FORTRAN-77, I post the following queries to the net: > > - how do you write a bitwise AND > - how about bitwise OR > You can use the equivalence construction to achieve this. As example, I give a fortran function that compute an AND bitwise operation: integer function AND(i1,i2) integer k1, k2,k3 logical j1,j2,j3 equivalence (k1,j1), (k2,j2), (k3,j3) k1=i1 k2=i2 j3=j1.and.j2 AND=k3 end If you substitute the [and,AND] by [or,OR] ..... -- Ahmed Amine JERRAYA IMAG-TIM3/INPG, 46 Avenue Felix Viallet, F-38031 GRENOBLE CEDEX - FRANCE Tel: 76 47 98 55 Ext: 607 UUCP: ...!seismo!mcvax!inria!archi!titine!jerraya or: jerraya@archi