Im working on a PHP Extension which is supposed to serialize PHP data into AMF3 format. The spec on page 2 describes a few data types that it deals with:
U16 - An unsigned 16-bit integer in big endian (network) byte order
U32 - An unsigned 32-bit integer in big endian (network) byte order
DOUBLE - 8 byte IEEE-754 double precision floating point value in network byte order (sign bit in low memory).
Im wondering about ints in PHP and how they might vary on different CPUs. Do we have any guarantee about the byte length of a PHP int? Is it always 4 bytes or could it be 8 bytes? Or two bytes? Is it really an int or a long?
What about Endianness? Ive read quite a bit of AMF3 conversion code and they appear to try and account for endianness when dealing with floats/doubles, but not with ints. Are ints affected by the systems endianness? What about longs?
Lastly, can anyone recommend an affordable way to gain access to the various systems where I might test 32-bit, 64-bit systems of both big and little endianness?
Any help would be much appreciated.
Im working on a PHP Extension which is supposed to serialize PHP data into AMF3 format. The spec on page 2 describes a few data types that it deals with:
U16 - An unsigned 16-bit integer in big endian (network) byte order
U32 - An unsigned 32-bit integer in big endian (network) byte order
DOUBLE - 8 byte IEEE-754 double precision floating point value in network byte order (sign bit in low memory).
Im wondering about ints in PHP and how they might vary on different CPUs. Do we have any guarantee about the byte length of a PHP int? Is it always 4 bytes or could it be 8 bytes? Or two bytes? Is it really an int or a long?
What about Endianness? Ive read quite a bit of AMF3 conversion code and they appear to try and account for endianness when dealing with floats/doubles, but not with ints. Are ints affected by the systems endianness? What about longs?
Lastly, can anyone recommend an affordable way to gain access to the various systems where I might test 32-bit, 64-bit systems of both big and little endianness?
Any help would be much appreciated.
|
|
Search Webmaster Help and Solution
Question about Endianness and byte lengthRelated ItemsQuery failed: connection to localhost:3354 failed (errno=111, msg=Connection refused). |
