www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/14/15:42:31

From: Chris Holmes <cholmes AT surfsouth DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: From Bytes to Int and Char
Date: Sat, 14 Aug 1999 15:11:14 -0400
Organization: Georgia Institute of Technology, Atlanta GA, USA
Lines: 18
Message-ID: <37B5BF52.5C00@surfsouth.com>
References: <rfXs3.4$bZ1 DOT 1603 AT typhoon01 DOT swbell DOT net> <37B466D7 DOT 958F09E5 AT americasm01 DOT nt DOT com> <37B4DFD1 DOT 4D66 AT surfsouth DOT com> <37B57EB0 DOT 492A93AE AT unb DOT ca> <37B5877D DOT 2343 AT surfsouth DOT com> <37B5BA42 DOT 3F05CED2 AT unb DOT ca>
NNTP-Posting-Host: r33h43.res.gatech.edu
Mime-Version: 1.0
X-Trace: news-int.gatech.edu 934658092 20906 128.61.33.43 (14 Aug 1999 19:14:52 GMT)
X-Complaints-To: usenet AT news DOT gatech DOT edu
NNTP-Posting-Date: 14 Aug 1999 19:14:52 GMT
X-Mailer: Mozilla 3.04Gold (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Endlisnis wrote:
> 
>     But, your code did the same thing, it casted it as a short* (which you stored in a
> temporary variable) and then augmented it with an offset.  You code would do the EXACT
> same thing as mine on any and all machines.  Both mechanisms were interpreting the int in
> a 'native' way.  What I was trying to say, was that if the file was saved in a big-endian
> machine and you were using a little-endian machine... both of our codes would not work.

  Yes, BUT if you RECOMPILED my code with a big-endian compiler, it 
would at least in theory produce the right output.  My code put the
work for conversion on the compiler's head, so if I moved to a 
big-endian compiler, then I wouldn't have to change my code.

  Chris

-- 
I'm easily bored, heavily armed, and off the medication.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019