Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: c programming q

Author: Gareth McCaughan

Date: 17:31:23 05/10/03

Go up one level in this thread


Robert Hyatt wrote:

>>>They have to be aligned left-to-right.  IE from will be the MSbyte, piece will
>>>be the LSbyte.
>>
>>No.
>
>left-to-right means "ascending address order"...

If that's what you meant by it, then that bit was correct.
But "from will be the MSbyte, piece will be the LSbyte"
is guaranteed only if you know the architecture the
thing is being compiled for. Ascending address order
needn't mean most significant byte first.

In fact, on ia32 systems it's exactly the other way around,
so if Zach's code is going to run on a PC then "from" will
be the least significant byte and "piece" the most.

Well, strictly even that isn't *guaranteed*, because:

>>There may be padding anywhere within the structure, including
>>between those single-byte fields.

Not that this is likely to be a problem in practice, in this
particular case.

--
g



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.