On Thu, Sep 22, 2005 at 12:07:48PM -0400, Matt Fowles wrote:
> 
> > Mark Biggar writes:
> > > d) use a magic number that can also be used as the byte order indicator.
> 
> I have seen architectures that swap byte ordering for 8 byte things
> (like doubles) but not 4 byte things.  So that gives 3 options and
> requires an 8 byte magic number if you want to do it that way.

"Ordering" is at least three potentially independent variables: byte
order in words, word order in dwords, and dword order in quads.
Writing a quad magic number in native order thus produces eight
possible eight-byte strings in 'file' databases.  Seems like we're
not playing to the strengths of the system that way.

Worse, a quad integer can't express other variations in machine
ordering that may arise, e.g. if dword order in quad integers differs
from dword order in doubles.

I think the right answer is to use a magic string rather than a
magic number.
-- 
Chip Salzenberg <[EMAIL PROTECTED]>

Reply via email to