On Thu, Sep 22, 2005 at 05:00:11PM +0100, Jonathan Worthington wrote: > Interesting, thanks - they make some good suggestions there. Our current > magic number is "13155a1" - I'm unsure of the rationale behind it, but > there may be a reason. If we're going to change the packfile format, we > may as well make sure we're squeezing whatever use we can out of our magic > number.
You raise a good question; how was the magic number chosen? > "Mark A. Biggar" <[EMAIL PROTECTED]> wrote: > >Joshua Hoblitt wrote: > > > >>a) live with it > >>b) change the magic number to be two identical bytes so the byte > >> ordering doesn't matter > >>c) shrink the magic number to be a single byte I left out another good option ... 4 identical bytes. ;) > When I talked about doing something endian-independent, I meant something > along the lines of store a sequence of, say, 4 bytes that will have certain > values. Forget reading the 4 bytes as an int at all, read it as a char[4] > and check each element is what it should be. Makes adding support to > "file" easy enough, and is my preferred solution. That would work if the magic 'number' was written as a 'string', which is not. Currently on x86 the magic number as written by parrot is 0x55a1 0x0131. I've figured out how to make C<file> to understand the current scheme but it's rather ugly. -- 16 lelong 0x013155a1 Parrot Bytecode (PBC), >0 byte x wordsize %d bytes, >1 byte =0 little endian, >1 byte =1 big endian, >2 byte x major %d, >3 byte x major %d, >4 byte x sizeof(INTVAL) == %d, >5 byte =0 FloatType is IEEE 754 >5 byte =1 FloatType is i387 `long double' 16 belong 0x013155a1 Parrot Bytecode (PBC), >0 byte x wordsize %d bytes, >1 byte =0 little endian, >1 byte =1 big endian, >2 byte x major %d, >3 byte x major %d, >4 byte x sizeof(INTVAL) == %d, >5 byte =0 FloatType is IEEE 754 >5 byte =1 FloatType is i387 `long double' -- > So, now we have two design decisions:- > 1) How to store the magic "number" > 2) What the magic "number" should be Good questions. Cheers, -J --
pgpqYYa7Uy4K7.pgp
Description: PGP signature