[Mono-dev] Endianess in resource reading

Marek Safar marek.safar at gmail.com
Fri Apr 10 08:33:42 UTC 2015


Hi Neale,

>
>
>                     if (!BitConverter.IsLittleEndian) {
>                         byte* bytePtr = (byte*) charPtr;
>                         var dest = new byte[byteLen];
>                         for (int i = 0; i < byteLen; i += 2) {
>                                 dest[i] = *(bytePtr+i+1);
>                                 dest[i+1] = *(bytePtr+i);
>                         }
>                         fixed(byte *pDest = dest) {
>                             s = new String((char *)pDest, 0, byteLen/2);
>                         }
>                     } else {
>                         s = new String(charPtr, 0, byteLen/2);
>                     }
>
>
Patch applied.

Thanks
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20150410/4cf40d21/attachment.html>


More information about the Mono-devel-list mailing list