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: bruce@ais.com Subject: Re: DEC Alpha- big endian or little endian? Date: 1996/02/04 Message-ID: <1996Feb4.213108.8721@ais>#1/1 X-Deja-AN: 138044765 references: <4ejjs1$2pr@sun20.ccd.bnl.gov> organization: Applied Information Systems, Chapel Hill, NC 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: > >>Folks- what is the endianess of the DEC Alpha machines? Little endien, like almost all DEC machines. >>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. >> >>I understand that it is possible to write a >> "data converter" to covert our data between >> little-endian and big-endian representations. >> >>This approach requires a fair amount of work >> and has some drawbacks, such as slower programs >> (if data is coverted on-the-fly) or increased >> disk space usage (if we have to keep two versions >> of the data- big-endian and little-endian). > > 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. This is some trouble if the data file format is anything but a simple array of binary numbers. For example, if the file has a long integer, then two shorts, then another long, etc, you can't just blindly swap bytes as if you were converting an array of long integers. If there are multiple record types that have to be converted in different ways then things can get even messier. If the code is at all reasonably organized, the read and write routines should be isolated and the conversion can be done in them, as you said. I've seen a lot of code that isn't, however :-). If your compiler is decent, it should be able to generate code to convert the data with no noticeable speed impact, unless all you're doing is copying the data from one file to another and not actually doing any real processing on it; then you _might_ be able to detect a slight slowdown, but your dominant time is almost certainly going to be disk I/O time. If the original author is expecting to use the DEC compilers, then he should have little problem in that area. Most of the people I know about who buy workstations are not very interested in the "endienness" of the workstation, so I'm not sure you're talking about a very big "big-endien workstation marketplace." But then, perhaps they have organized their code better than this code sounds like it is organized. Bruce C. Wright