Commit 60f8c2ef by Nicolas Capens Committed by Nicolas Capens

Prevent clang-format from splitting shift operator

The expression "IfThenElse(e < 24, mantissa >> e, Int(0))" gets rewritten into "IfThenElse(e<24, mantissa> > e, Int(0))" by some versions of clang-format, thus breaking the build. It's likely a clang-format bug that should be fixed, but the workaround is simple and still quite elegant: "IfThenElse(e < 24, (mantissa >> e), Int(0))" Bug: b/144825072 Change-Id: I9cc19c6cae31bb0452b4e5402f6a742d15c45e55 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39428 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent c77b1d8c
...@@ -3778,7 +3778,7 @@ Half::Half(RValue<Float> cast) ...@@ -3778,7 +3778,7 @@ Half::Half(RValue<Float> cast)
{ {
Int mantissa = (abs & 0x007FFFFF) | 0x00800000; Int mantissa = (abs & 0x007FFFFF) | 0x00800000;
Int e = 113 - (abs >> 23); Int e = 113 - (abs >> 23);
abs = IfThenElse(e < 24, mantissa >> e, Int(0)); abs = IfThenElse(e < 24, (mantissa >> e), Int(0));
fp16i |= UShort((abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13); fp16i |= UShort((abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13);
} }
Else Else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment