diff options
Diffstat (limited to 'source/slang')
| -rw-r--r-- | source/slang/slang-check-impl.h | 10 | ||||
| -rw-r--r-- | source/slang/slang-mangle.cpp | 12 |
2 files changed, 12 insertions, 10 deletions
diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index 623f18b22..bd2392c67 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -23,15 +23,15 @@ namespace Slang // A flat representation of basic types (scalars, vectors and matrices) // that can be used as lookup key in caches - enum class BasicTypeKey : uint8_t + enum class BasicTypeKey : uint16_t { - Invalid = 0xff, ///< Value that can never be a valid type + Invalid = 0xffff, ///< Value that can never be a valid type }; - SLANG_FORCE_INLINE BasicTypeKey makeBasicTypeKey(BaseType baseType, IntegerLiteralValue dim1 = 1, IntegerLiteralValue dim2 = 1) + SLANG_FORCE_INLINE BasicTypeKey makeBasicTypeKey(BaseType baseType, IntegerLiteralValue dim1 = 0, IntegerLiteralValue dim2 = 0) { - SLANG_ASSERT(dim1 > 0 && dim2 > 0); - return BasicTypeKey((uint8_t(baseType) << 4) | ((uint8_t(dim1) - 1) << 2) | (uint8_t(dim2) - 1)); + SLANG_ASSERT(dim1 >= 0 && dim2 >= 0); + return BasicTypeKey((uint8_t(baseType) << 8) | (uint8_t(dim1) << 4) | uint8_t(dim2)); } inline BasicTypeKey makeBasicTypeKey(Type* typeIn) diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp index 3b65d196d..b0568994f 100644 --- a/source/slang/slang-mangle.cpp +++ b/source/slang/slang-mangle.cpp @@ -83,11 +83,13 @@ namespace Slang // for (auto c : str) { - if (('a' <= c) && (c <= 'z')) { encoded.append(c); } - if (('A' <= c) && (c <= 'Z')) { encoded.append(c); } - if (('0' <= c) && (c <= '9')) { encoded.append(c); } - - if (c == '_') + if (('a' <= c) && (c <= 'z') + || ('A' <= c) && (c <= 'Z') + || ('0' <= c) && (c <= '9')) + { + encoded.append(c); + } + else if (c == '_') { encoded.append("_u"); } |
