From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103885,20ac8f08b884ba5 X-Google-Attributes: gid103885,public X-Google-Thread: 111c93,20ac8f08b884ba5 X-Google-Attributes: gid111c93,public X-Google-Thread: 1094ba,10f7c56bf397ed71 X-Google-Attributes: gid1094ba,public From: lindahl@pbm.com (Greg Lindahl) Subject: Re: Forcing 32-bit integers and math Date: 1998/10/15 Message-ID: <705o8j$g5f@news1.newsguy.com>#1/1 X-Deja-AN: 401493227 References: <705c5g$pl@bgtnsc01.worldnet.att.net> Organization: a guest of Shadow Island Games Newsgroups: comp.lang.fortran,comp.graphics.visualization,comp.os.linux.alpha "James Giles" writes: > All Fortran I/O libraries I've seen (and I've even written one) have > a record mark which contains both the length of the next record > and the length of the preceeding record. Conceptual difference: I call that 2 record marks. At the start of the file there is only 1 record mark. > On Crays, this was represented > as a 64-bit quantity: the first 32 were the length of the preceeding > record and the second 32 were the length of the following record. I just looked on a Cray and it seems to have changed formats between f77 and f90. The new format is considerably different. -- g unicos% od o 0000000000000 000000 000000 000000 000001 000000 000000 000000 000020 [ r1 length ? ] [ record 1 data ] 0000000000020 100000 000000 000000 000001 000000 000000 000000 000021 [ combo of r1 and r2 len? ] [ record 2 data ] 0000000000040 100000 000000 000000 000000 160000 000000 000000 000000 [ r2 length? ] 0000000000060 170000 000000 000000 000000 000000 000000 000000 000000 0000000000100 000000 000000 000000 000000 000000 000000 000000 000000 * 0000000010000 A bit satantic for my taste, with the reverse lengths reversed? unicos% cat test.f program test open (unit=21, file = 'o', form='unformatted', status='unknown') write (21) 16 write (21) 17 close (unit=21) stop end 32-bit linux% od o 0000000 000004 000000 000020 000000 000004 000000 000004 000000 ^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^ little-endian data repeat of length of length in bytes r1 length record 2 0000020 000021 000000 000004 000000 ^^^^^^^^^^^^^ ^^^^^^^^^^^^^ record 2 data repeat of r2 length 64-bit linux% od o 0000000 000004 000000 000000 000000 000020 000000 000004 000000 0000020 000000 000000 000004 000000 000000 000000 000021 000000 0000040 000004 000000 000000 000000 0000050 Note the 32-bit lengths are now 64-bit lengths.