Rob*_*cks 9 vb.net bit-manipulation operators bit-shift
如何在VB.NET中按位左右按位移位?它甚至有操作员,还是我必须使用一些实用方法?
myFinal = myInteger << 4 ' Shift LEFT by 4 bits.
myFinal = myInteger >> 4 ' Shift RIGHT by 4 bits.
Run Code Online (Sandbox Code Playgroud)
您也可以将它作为一元运算符使用...
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.
Run Code Online (Sandbox Code Playgroud)