CKTIS / C#
>>: practical reference
>>: practical reference: >> shifts bits right; for signed operands it performs an arithmetic shift that propagates the sign bit.
Version: C# operator reference; verified against C# 14
Syntax
left >> rightshifts bits right; for signed operands it performs an arithmetic shift that propagates the sign bit.
Use it to extract bit fields after deliberately choosing signed or unsigned interpretation.
For a negative value it fills with ones, unlike >>>.
The shift count is masked and discarded low bits are lost.
The complete program actually uses >>; its exact expected stdout is 4.
Examples
using System;
using System.Linq;
using System.Threading.Tasks;
Console.WriteLine(16 >> 2);
Result
4
The complete program actually uses `>>`; its exact expected stdout is `4`.