HLSL: Add parens in unpackUint2x32 for clarity.

This commit is contained in:
Hans-Kristian Arntzen 2020-04-21 11:48:37 +02:00
parent e4e4791c4e
commit 7b9cba7424
3 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,7 @@ struct SPIRV_Cross_Output
uint64_t SPIRV_Cross_packUint2x32(uint2 value)
{
return uint64_t(value.y) << 32 | uint64_t(value.x);
return (uint64_t(value.y) << 32) | uint64_t(value.x);
}
uint2 SPIRV_Cross_unpackUint2x32(uint64_t value)
@ -15,7 +15,7 @@ uint2 SPIRV_Cross_unpackUint2x32(uint64_t value)
uint2 Unpacked;
Unpacked.x = uint(value & 0xffffffff);
Unpacked.y = uint(value >> 32);
return Unpacked;
return Unpacked;
}
void frag_main()

View File

@ -7,7 +7,7 @@ struct SPIRV_Cross_Output
uint64_t SPIRV_Cross_packUint2x32(uint2 value)
{
return uint64_t(value.y) << 32 | uint64_t(value.x);
return (uint64_t(value.y) << 32) | uint64_t(value.x);
}
uint2 SPIRV_Cross_unpackUint2x32(uint64_t value)
@ -15,7 +15,7 @@ uint2 SPIRV_Cross_unpackUint2x32(uint64_t value)
uint2 Unpacked;
Unpacked.x = uint(value & 0xffffffff);
Unpacked.y = uint(value >> 32);
return Unpacked;
return Unpacked;
}
void frag_main()

View File

@ -1507,7 +1507,7 @@ void CompilerHLSL::emit_resources()
{
statement("uint64_t SPIRV_Cross_packUint2x32(uint2 value)");
begin_scope();
statement("return uint64_t(value.y) << 32 | uint64_t(value.x);");
statement("return (uint64_t(value.y) << 32) | uint64_t(value.x);");
end_scope();
statement("");
@ -1516,7 +1516,7 @@ void CompilerHLSL::emit_resources()
statement("uint2 Unpacked;");
statement("Unpacked.x = uint(value & 0xffffffff);");
statement("Unpacked.y = uint(value >> 32);");
statement("return Unpacked; ");
statement("return Unpacked;");
end_scope();
statement("");
}