How to bitwise shift in VB.NET?

痴心易碎 提交于 2019-12-01 15:51:20
Mehrdad Afshari

VB.NET has had bit shift operators (<< and >>) since 2003.

Robinicks

You can use the << and >> operators, and you have to specify how many bits to shift.

myFinal = myInteger << 4   ' Shift LEFT by 4 bits.
myFinal = myInteger >> 4   ' Shift RIGHT by 4 bits.

You can also use it as a unary operator...

myFinal <<= 4     ' Shift myFinal LEFT by 4 bits, storing the result in myFinal.
myFinal >>= 4     ' Shift myFinal RIGHT by 4 bits, storing the result in myFinal.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!