HipcGenerator: skip do-nothing call to MemoryMarshal.Cast<byte, byte>() in generated code

This commit is contained in:
Jim Horvath 2024-02-22 22:12:49 -05:00
parent d4d0a48bfe
commit efbea8ab03

View file

@ -719,7 +719,9 @@ namespace Ryujinx.Horizon.Generators.Hipc
private static string GenerateSpanCast(string targetType, string input)
{
return $"MemoryMarshal.Cast<byte, {targetType}>({input})";
return targetType == "byte"
? input
: $"MemoryMarshal.Cast<byte, {targetType}>({input})";
}
private static bool HasAttribute(Compilation compilation, ParameterSyntax parameterSyntax, string fullAttributeName)