What is the C# equivalent of Java unsigned right shift operator >>>

前端 未结 5 2179
轮回少年
轮回少年 2020-12-07 00:32

I am trying to convert some Java code to C#. How can the following unsigned right shift operation be represented in C#?

int src1, src2, ans;
ans = src1 >&         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 01:01

    C#'s >> operator is sensitive to the operator's signed status (int vs uint). If you need to operate on an int, cast to uint first.

提交回复
热议问题