[llvm] [SPIR-V] Simplify and fix sign-extension bug in convertCharsToWord (PR #207769)
Arseniy Obolenskiy via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 7 01:09:43 PDT 2026
================
@@ -161,7 +161,7 @@ static uint32_t convertCharsToWord(const StringRef &Str, unsigned i) {
if (StrIndex < Str.size()) { // If it's within the string, get a real char.
CharToAdd = Str[StrIndex];
}
- Word |= (CharToAdd << (WordIndex * 8));
+ Word |= (static_cast<uint32_t>(CharToAdd) << (WordIndex * 8));
}
return Word;
}
----------------
aobolensk wrote:
Yes, that could be replaced with memcpy, thanks!
https://github.com/llvm/llvm-project/pull/207769
More information about the llvm-commits
mailing list