Platform Interoperable Data Types
Platform interoperable data types are implemented in the DataReel library in order to achieve database and network interoperability in heterogeneous computing environments. Essentially they allow database files and client/server applications to overcome the big and little endian byte ordering problems encountered when writing integer and floating point values to a common database file or device accessed by several different types of hardware architectures. The term "endian" is used to describe the order in which multi-byte numbers are stored in the computer's memory. File addresses or offsets are multi-byte numbers used to point to specific locations in a disk file. The byte order in which multi-byte numbers are stored in a computer's memory is specific to each microprocessor. For example, the Intel x86 family is little-endian, meaning that the lowest-order byte is stored first. Hewlett-Packard's PA-RISC and Sun's SuperSPARC are big-endian, meaning the highest-order byte is stored first. The Silicon Graph ics MIPS and IBM/Motorola Power PC processors are both little and big endian (bi-endian). A file address stored in a disk file will represent different values if the file is created on one system and read on the other system.
Value |
Big-Endian |
Little-Endian |
0x12345678 |
0x12345678 |
0x78563412 |
0x1234 |
0x1234 |
0x3412 |
0x5678 |
0x5678 |
0x7856 |
"ABC" |
41 42 43 |
41 42 43 |
With big-endian ordering, the address of the multi-byte value is its most significant byte (its big end.) With little-endian ordering, the address of the multi-byte value is its least significant byte (its little end.) Character stings are stored in memory exactly as they appear regardless of the byte ordering used. In a data structure the order of bytes in memory will differ depending on the byte ordering and the particular data type used. If the contents of a data structure are written to disk or a device, the byte ordering will affect the data when it is moved to another platform.
In order to gain platform interoperability database files and network routines must use there own representation of 32 and 64 bit-signed integers for file addresses and network headers. By manipulating multi-byte values in memory before they are written to disk or across a network connection, it is possible to represent 32 and 64 bit signed integers independently of the operating system and/or hardware platform used.
The same scheme used to overcome the byte ordering problem encountered with 32 and 64 bit signed integers is also applied to unsigned integers and floating point values. String values are represented in memory exactly as they appear. Since none of the bytes in a string are reordered in memory, they can be written directly from memory to disk or across a network connection regardless of the platform used to create them.
End Of Document |