C# bitwise shift on ushort (UInt16)

I need to perform a bitwise left shift on a 16-bit integer (ushort / UInt16), but the bitwise operators in C# seem to apply to int (32-bit) only. How can I use << on an ushort, or at least get to the same result with a simple workaround?


移位后将结果值转换回ushort:

ushort value = 1;
ushort shifted = (ushort)(value << 2);
链接地址: http://www.djcxy.com/p/72496.html

上一篇: 按位操作何时适合

下一篇: ushort上的C#按位移动(UInt16)