3 ms·
If you are willing to assume that the masks each only have 1 bit set, this would be less of a mouthful although it would draw other objections: if (@popCount
by tzs 4y ago
If you are willing to assume that the masks each only have 1 bit set, this would be less of a mouthful although it would draw other objections:
if (@popCount(mask & (WGPUColorWriteMask_Alpha|WGPUColorWriteMask_Blue)) == 2)
I do not know Zig, so the syntax might not be right. I did check to see that it has popcount [1].
If it has some concise way to flip all the bits, then this would be another possibility that isn't too verbose, but might raise other objections. Let fmask be mask with all the bits flipped (how would one do that in Zig?).
if ((fmask & (WGPUColorWriteMask_Alpha|WGPUColorWriteMask_Blue)) == 0)
[1] https://ziglang.org/documentation/master/#popCount https://ziglang.org/documentation/master/#popCount
- nurbl 4y agoI think the point of the example is that in zig you'd just do if (mask.alpha and mask.blue) {