From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d2fe923345e67606 X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: Byte sex confusion Date: 1997/05/08 Message-ID: <01bc5bfd$78858100$LocalHost@xhv46.dial.pipex.com>#1/1 X-Deja-AN: 240297076 References: <33716475.43A9@top.monad.net> Organization: UUNet PIPEX server (post doesn't reflect views of UUNet PIPEX) Newsgroups: comp.lang.ada Date: 1997-05-08T00:00:00+00:00 List-Id: Steven O'Neill wrote in article <33716475.43A9@top.monad.net>... > I have an interesting problem well known to anyone who has tried to > develop on multiple platforms. I have binary data that was recorded on > a big-endian machine (SGI) which I am in need of reading on a > little-endian machine (Intel). The current method involves using C > routines to fread the data into buffers and then casting the data into a > variety of Ada records. > > This is a dangerous practice (its not my code) but it works fine as long > as the layout of the records remain the same and the underlying data > formats are consistent. > > What I'm looking for are ideas on how to access this data in an easy anc > consistent fashion on both architectures... Any ideas? I'm currently fascinated by Intel's BSWAP instruction (little things please little minds, I suppose :-). If you have package Machine_Code available, maybe this one would solve your problem. Incidentally, for those readers wondering, the 'sex' in the subject line refers (I assume, anyway) to the old Intel "sign exchange" instruction, which they were going to call SEX, but got cold feet just before publication (and called it CBW/CWD instead - not the same!) Nick.