Path: utzoo!attcan!uunet!know!sdd.hp.com!wuarchive!cs.utexas.edu!sun-barr!newstop!sun!boise.Eng.Sun.COM!wsb From: wsb@boise.Eng.Sun.COM (Walt Brainerd) Newsgroups: comp.lang.fortran Subject: Re: Fortran 77 Intrinsic Functions Summary: They're in Fortran 90 Message-ID: <143520@sun.Eng.Sun.COM> Date: 9 Oct 90 18:24:16 GMT References: <6724.27106469@ccvax.ucd.ie> <26720@shamash.cdc.com> Sender: news@sun.Eng.Sun.COM Lines: 36 In article <26720@shamash.cdc.com>, ddh@hare.cdc.com (Dan Horsfall) writes: > In article <6724.27106469@ccvax.ucd.ie> beamishd@ccvax.ucd.ie writes: > > I am looking for a list of ... bit manipulation functions. > > Thanks > > > > Norman Beamish > > Dublin Ireland > > You won't find such a thing. FORTRAN deals with word-oriented units, > not bits; bits are (obviously, I hope) machine dependent. Now, most > compiler writers provide intrinsic functions of some type, or even > source language constructs for manipulating bits, but ANSI 77 does not > because it _can_ not. > > -- This states exactly why bit manipulation was not in F77. However, as mentioned by another poster, such functions are in the MIL STD; therefore there was pressure to include them in F90. Since the charter of the standard development is portability, the "bit" manipulation functions actually work on integers in the following way: You convert the integer(s) to a bit string that looks like the binary representation of the integer, then do the "logical" operation bit-by-bit, then convert the result back to integer. Too bad if your internal representation of integers does not happen to match the model given in the standard, but it should in most??? cases. The names are all wrong, because the MIL STD ones were adopted. For example "and" is IAND and the one called MVBITS actually copies bits! -- Walt Brainerd Sun Microsystems, Inc. wsb@eng.sun.com MS MTV 5-40 Mountain View, CA 94043 415/336-5991