From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,7e86b7f8965dd11d X-Google-Attributes: gid1164f8,public From: olchansk@a0.phy.bnl.gov (Konstantin Olchanski) Subject: Re: DEC Alpha- big endian or little endian? Date: 1996/02/09 Message-ID: <4ffml4$fb2@sun20.ccd.bnl.gov>#1/1 X-Deja-AN: 139324562 references: <4ejjs1$2pr@sun20.ccd.bnl.gov> organization: Brookhaven National Laboratory newsgroups: comp.sys.dec In article , jfm6@jagunet.com (John McNamara) writes: > In article <4ejjs1$2pr@sun20.ccd.bnl.gov>, > olchansk@a0.phy.bnl.gov (Konstantin Olchanski) wrote: > > > >The problem is that all our data sets are written in the > > big-endian format and the little-endian version > > of our code cannot read them. > > Why not just write the few lines of code to swap bytes on > read and write? If you're really dealing with large files, > the programs are likely memory bound in which case the few > extra logical ops to swap bytes should be essentially free. "just swapping bytes" gets somewhat complicated if the data is a horrible mix of ints, shorts and chars... but, I guess there is no other way... I am considering writing a program in perl to read the C header files and automatically produce endian-changing routines. Maybe somebody already did this? Any suggestions? C.O.