lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Thu, Mar 11, 2010 at 4:58 PM, Roberto Ierusalimschy
<> wrote:
>>   From: Flemming Madsen <>
>>   Date: Thu, Oct 15, 2009 at 12:50 AM
>>   Subject: Struct library patch WAS: Roberto's struct library missing
>> "size" function?
>> and lacks a way to reset to native endianness.
> Do you have real examples of uses for packing with mixed endianess?

Unfortunately, yes, we implemented a protocol that was like this.

If I was to guess why they used mixed endianness, I think it was
because they were verbatim memcpying ucs-2 strings from their COM
interfaces, with leading string lengths, into their protocol header as
a "system name", but the rest of the header used network byte order.

In fairness, we knew that the other end was intel windows, so the
native part was little endian, and the surrounding part was big
endian, so we didn't need the _ to reset the order.