diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-12 10:21:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 10:21:27 +0100 |
commit | d1dbe21c56b25aea4143db13a8fbf41bc8df1c2b (patch) | |
tree | 9f527e7f31e720b97516a33daac77c9bd825aa51 /thirdparty/glslang/SPIRV/spvIR.h | |
parent | f5a27ee4fe45925cebfda11ea7d53ca8f39e0a13 (diff) | |
parent | 84d7a695704c439b86d8202ccd768bcd07eabfff (diff) |
Merge pull request #57980 from akien-mga/vulkan-1.3.204
Diffstat (limited to 'thirdparty/glslang/SPIRV/spvIR.h')
-rw-r--r-- | thirdparty/glslang/SPIRV/spvIR.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/thirdparty/glslang/SPIRV/spvIR.h b/thirdparty/glslang/SPIRV/spvIR.h index 486e80d000..5249a5ba73 100644 --- a/thirdparty/glslang/SPIRV/spvIR.h +++ b/thirdparty/glslang/SPIRV/spvIR.h @@ -111,27 +111,23 @@ public: void addStringOperand(const char* str) { - unsigned int word; - char* wordString = (char*)&word; - char* wordPtr = wordString; - int charCount = 0; + unsigned int word = 0; + unsigned int shiftAmount = 0; char c; + do { c = *(str++); - *(wordPtr++) = c; - ++charCount; - if (charCount == 4) { + word |= ((unsigned int)c) << shiftAmount; + shiftAmount += 8; + if (shiftAmount == 32) { addImmediateOperand(word); - wordPtr = wordString; - charCount = 0; + word = 0; + shiftAmount = 0; } } while (c != 0); // deal with partial last word - if (charCount > 0) { - // pad with 0s - for (; charCount < 4; ++charCount) - *(wordPtr++) = 0; + if (shiftAmount > 0) { addImmediateOperand(word); } } |