Skip to content
Prev 14753 / 15075 Next

Bug in reading UTF-16LE file?

Definitely not about R... but to the question:

All C compilers (well, really all computer languages) logically regard integers as big-endian, regardless of whether the underlying bytes are BE or LE. Converting a byte stream (bytes) to wide character data (ints or uints) only needs to swap bytes in the LE case using bit shifting.

You cannot rely on "same as my architecture" pointer re-interpretation of multi-byte values because most of the time the word size won't match and even if it does the word-boundary alignment will usually be off and the pointer dereference will fail.
On September 9, 2024 1:53:45 AM PDT, peter dalgaard <pdalgd at gmail.com> wrote: