Unity-Technologies / Unity.Mathematics

The C# math library used in Unity providing vector types and math functions with a shader like syntax
Other
1.38k stars 156 forks source link

Integer vector per-component bitshift #219

Closed Floris0106 closed 2 years ago

Floris0106 commented 2 years ago

Currently, int and uint vector types support bitshifting, but only with int and uint scalar values. It would be nice to have bitshifts also work on vectors of the same size, like HLSL supports as well.

Floris0106 commented 2 years ago

Nevermind, I tried to implement this myself to make a pull request, but I discovered compiler error CS0564, which states: "The first operand of an overloaded shift operator must have the same type as the containing type, and the type of the second operand must be int". Thus, the proposed bitshift operator like in HLSL cannot exist in C# currently.