summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2024-11-08 13:03:42 -0500
committerGitHub <noreply@github.com>2024-11-08 13:03:42 -0500
commitf66b046e2767cd7a38acec8c0f988e5937f062e7 (patch)
tree178b745cea2479675a368cb67526833aad554630 /source/slang/slang-emit-c-like.cpp
parent0f46ce82998b2b1cb68f04bef3a097ea850ad453 (diff)
[WGSL] [WASM] Add reflection endpoints + Fix bit manipulation operations (#5499)
* Add key reflection endpoints for WASM * Fix WGSL output around bit-manipulation operators * format code * Fix pointer ownership * fix formatting --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index 020c31fdc..790162c5b 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -693,6 +693,13 @@ bool CLikeSourceEmitter::maybeEmitParens(EmitOpInfo& outerPrec, const EmitOpInfo
{
needParens = true;
}
+ // a ^ b * c => (a ^ b) * c
+ else if (
+ prec.rightPrecedence == EPrecedence::kEPrecedence_BitXor_Right &&
+ outerPrec.rightPrecedence == EPrecedence::kEPrecedence_Multiplicative_Left)
+ {
+ needParens = true;
+ }
if (needParens)
{