1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[llvm-readobj] Fix 'Teach readobj to dump .res files', pt 2.

Another fix-up for r313790. Big-endian hosts swapped byte order in
UTF16 words.

llvm-svn: 313833
This commit is contained in:
Marek Sokolowski 2017-09-20 23:07:39 +00:00
parent ec81f6718b
commit 0c12f89e99

View File

@ -26,8 +26,11 @@ std::string stripUTF16(const ArrayRef<UTF16> &UTF16Str) {
Result.reserve(UTF16Str.size());
for (UTF16 Ch : UTF16Str) {
if (Ch <= 0xFF)
Result += Ch;
// UTF16Str will have swapped byte order in case of big-endian machines.
// Swap it back in such a case.
ulittle16_t ChValue = Ch;
if (ChValue <= 0xFF)
Result += ChValue;
else
Result += '?';
}