Sergio0694 / ComputeSharp

A .NET library to run C# code in parallel on the GPU through DX12, D2D1, and dynamically generated HLSL compute and pixel shaders, with the goal of making GPU computing easy to use for all .NET developers! 🚀
MIT License
2.65k stars 122 forks source link

Shifting left `int4 << int` is "ambiguous" ? #817

Closed rickbrew closed 1 month ago

rickbrew commented 1 month ago

IIRC this was something that couldn't be resolved in a previous version of C#, but now it's possible?

You can't do something like,

int4 x = ...;
int4 y = x << 1; // "ambiguous"

image

If you cast to int4 then it's fine of course

int4 x = ...;
int4 y = x << (int4)1;

Same thing happens if you use uint[4]:

image

There might be other shift scenarios that aren't working conveniently, I haven't looked just yet