summaryrefslogtreecommitdiff
path: root/thirdparty/glslang/SPIRV/spvIR.h
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-12 10:21:27 +0100
committerGitHub <noreply@github.com>2022-02-12 10:21:27 +0100
commitd1dbe21c56b25aea4143db13a8fbf41bc8df1c2b (patch)
tree9f527e7f31e720b97516a33daac77c9bd825aa51 /thirdparty/glslang/SPIRV/spvIR.h
parentf5a27ee4fe45925cebfda11ea7d53ca8f39e0a13 (diff)
parent84d7a695704c439b86d8202ccd768bcd07eabfff (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.h22
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);
}
}