🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #3453

Re: RISC Machine Data Structure Word Alignment Problems?

#3453
From: Wm E. Davidsen Jr
Date: Mon, 22 Jan 1990 02:50
31 lines
1676 bytes
johnl@esegue.segue.boston.ma.us (John R. Levine) writes:

| long read_long(void)
| {
| 	long v;
| 
| 	/* read in big endian order */
| 	v = getc(f) << 24;	/* should do some error checking */
| 	v |= getc(f) << 16;
| 	v |= getc(f) << 8;
| 	v |= getc(f);
| 	return v;
| }
| 
| This may seem like more work, but in my experience you write a few of these
| things and use them all over the place.  Then your code is really portable.

  I agree with your thought, although for portable transfer I usually do
LSB first (not because of any preference) just for the loop. Since I
work with 36 and 64 bit machines, I always add a sign extend on the
read.

  At one time I was operating a PC (original IBM) with a unique
coprocessor Cray2 on an ethernet link. The C2 calculated data and passed
it in 32 bit RLE format to a BASIC program which used calls to write the
display. Amazing what you can do to get a demo up FAST.
-- 
	bill davidsen - sysop *IX BBS and Public Access UNIX
davidsen@sixhub.uucp		...!uunet!crdgw1!sixhub!davidsen

"Getting old is bad, but it beats the hell out of the alternative" -anon
Technical Details
Message-ID: <428@sixhub.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!crdgw1!sixhub!davidsen
References: <111@melpar.UUCP> <1990Jan21.224826.1699@esegue.segue.boston.ma.us>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!crdgw1!sixhub!davidsen
From: davidsen@sixhub.UUCP (Wm E. Davidsen Jr)
Newsgroups: comp.arch,comp.lang.c
Subject: Re: RISC Machine Data Structure Word Alignment Problems?
Keywords: risc sun
Message-ID: <428@sixhub.UUCP>
Date: 22 Jan 90 02:50:19 GMT
References: <111@melpar.UUCP> <1990Jan21.224826.1699@esegue.segue.boston.ma.us>
Reply-To: davidsen@sixhub.UUCP (bill davidsen)
Followup-To: comp.arch
Organization: *IX Public Access UNIX, Schenectady NY
Lines: 31