Why does the C# compiler translate this != comparison as if it were a > comparison?

Short answer: There is no “compare-not-equal” instruction in IL, so the C# != operator has no exact correspondence and cannot be translated literally. There is however a “compare-equal” instruction (ceq, a direct correspondence to the == operator), so in the general case, x != y gets translated like its slightly longer equivalent (x == y) … Read more

What are bitwise shift (bit-shift) operators and how do they work?

The bit shifting operators do exactly what their name implies. They shift bits. Here’s a brief (or not-so-brief) introduction to the different shift operators. The Operators >> is the arithmetic (or signed) right shift operator. >>> is the logical (or unsigned) right shift operator. << is the left shift operator, and meets the needs of … Read more