delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/19/23:48:51

From: Damian Yerrick <MYNAMEISd_yerrick AT hotmail DOT comNO2CANNEDHAM>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Casting pointers
Organization: Pin Eight Software <http://pineight.8m.com/>
Message-ID: <cfvc8sk341im9jjtgm1eugovbnh4km6129@4ax.com>
References: <865adi$tbm$1 AT bird DOT wu-wien DOT ac DOT at> <38863BDF DOT 44 AT erols DOT com>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 26
X-Trace: /K+neUtoJjXnlo9nK+8sU712fyhtTpvf3f+KXnYpeQ/FlfXgdH/KOBF9FHLmuHlL3CPg2e7m9gTF!yIfTwCNQu6juF1TMVYmKJldetJFVbJUc3vrgzHohSOAgTsLN1HBuS66JFFzRAW5ltNKCBgIAGw==
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Thu, 20 Jan 2000 03:22:05 GMT
Distribution: world
Date: Thu, 20 Jan 2000 03:22:05 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"John S. Fine" <johnfine AT erols DOT com> wrote in message
<38863BDF DOT 44 AT erols DOT com>...
>  There ought to be an (inline) function defined in
>some .h file to reverse the bytes in a long, so you
>can use longs from MSB sources (data files or network
>protocols) in an LSB program.

htonl() ntohl()

As always, you can get information on any DJGPP symbol with info:
C:\>info libc alpha [function-name]

An inline assembly implementation might look like this:
  load number into eax  0123
  swap bytes of ax      0132
  swap shorts of eax    3201
  swap bytes of ax      3210

Or is this already how it works?

-- 
Damian Yerrick  http://yerricde.tripod.com/
View full sig at http://www.rose-hulman.edu/~yerricde/sig.html
Comment on story ideas at http://home1.gte.net/frodo/quickjot.html

And yes, I have set my attribute line to emulate Outhouse Express.

- Raw text -


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