本文介绍了Java无符号右移运算符>>的C#等效项是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将一些Java代码转换为C#。下列如何用C#表示?
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 >>> src2;
推荐答案
您必须先强制转换,没有一个运算符对于>>>,代码示例:
You have to cast first, there is not one operator for >>>, code sample:
int x = -100;
int y = (int)((uint)x >> 2);
Console.WriteLine(y);
这篇关于Java无符号右移运算符>>的C#等效项是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!