Yet another question what does this operator do? How would I write that in C#:
data[id] = R >> 0;
data[id + 1] = G >> 0;
data[id + 2] = B >> 0;
Yet another question what does this operator do? How would I write that in C#:
data[id] = R >> 0;
data[id + 1] = G >> 0;
data[id + 2] = B >> 0;
I assume you're talking about the >>
operator. It's a right shift operator that first (if necessary) converts the left argument to an integer and then shifts right by the indicated number of bits. Shifting by 0 bits leaves the number unchanged, so R >> 0
is a cute way of forcing R
to an integer. It works like Math.floor(R)
for non-negative values.
In C#, I believe that you can do the same thing with a cast: (int) R
, etc.