[futurebasic] Re: [FB] Re: Writing Numericals to Disk

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2007 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Thu, 4 Oct 2007 15:39:56 -0700
On Oct 4, 2007, at 9:56 AM, Harold Boone wrote:

>
>>
>>
>>> Jay's method the fastest method - but if I understand correctly  
>>> (a big IF) this will also get you into trouble with endian issues  
>>> if your data has to move between PPC and Intel.
>> For FBtoC-created applications byte swapping is done if Read# and  
>> Write# are used. It uses the strategy of writing everything to  
>> disk as big-endian and then doing the swap to host on a read or a  
>> swap to big on a write. Read File and Write File do no Endian  
>> swapping
> What are endian issues and Indian swapping?

There has been a lot written on this topic. You might want to start  
with Apple's "Memory Management Programming Guide for Core  
Foundation" and the section titled "Byte Ordering" This doc is  
available on the Apple developer web site and also in the  
documentation included with Xcode. It includes both a description and  
examples to illustrate the issue.

The issue is basically the difference in byte ordering between  
different computers (specifically a PowerPC Mac versus an Intel Mac).  
PowerPC uses what is known as big-endian and Intel uses Little-endian  
byte ordering. Each method is just the reverse of the other and the  
name is from Gulliver's Travels (where one group ate eggs from the  
big and and the other from the little end).

Again, this should not be an issue unless you create data (i.e. disk  
files) that is shared with other computers using the "other" byte  
ordering method (i.e. if data is created on a PowerPC mac, the  
"other" is an Intel Mac and vice versa)

Brian S.