[Gambas-user] gb3 RC1: using structures to replace the loss of Mk$ functions

Kevin Fishburne kevinfishburne at ...1887...
Fri Apr 8 09:04:08 CEST 2011


On 04/08/2011 02:32 AM, Doriano Blengino wrote:
> Kevin Fishburne ha scritto:
>>
>> Ahh, I understand a little better. I don't know much about endianness,
>> so please excuse my ignorance here. When reading socket data into a
>> string how is the data affected exactly? I can think of a few possibilities:
>>
>> 1) The byte order of the entire string is reversed ("abcd" becomes "dcba")
>> 2) The bit order of the entire string is reversed (00001111 becomes
>> 11110000)
>> 3) The byte order of the values is reversed (0000 1111, 1010 1100
>> becomes 1111 0000, 1100 1010)
>> 4) The bit order of the values is reversed(0000 1111, 1010 1100 becomes
>> 1111 0000, 0011 0101)
>>
> Endiannes refers to the order the bytes are kept in memory, when a
> numerical multi-byte value is involved. Strictly speaking, strings are
> not affected. For example, human beings are big endian: the number 10,
> composed by two digits, is written with the weighter digit first. If
> human beings were little endian, they wrote this number as "01".
>
> ...

That is very good info, thank.

So if endianness generally describes the byte order, not the bit order, 
then either each value (two, four or eight bytes) is reversed or the 
entire string is reversed. Hopefully it's the former rather than the 
latter, as that would be easier to compensate for.

While it would be slow, I could just write functions for flipping the 
byte order of characters in a string. That would work fine for the 
client but may impact performance server side. I'll do some 
experimenting tomorrow to see what I can come up with.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list