myFinal = myInteger << 4 ' Shift LEFT by 4 bits.
myFinal = myInteger >> 4 ' Shift RIGHT by 4 bits.
您还可以将它用作一元运算符......
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.
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.
发布评论
评论(2)
VB.NET 具有位移运算符 (<代码><< 和
>>
)自 2003 年起。VB.NET has had bit shift operators (
<<
and>>
) since 2003.您可以使用 << 和 >> 运算符,并且您必须指定要移动多少位。
您还可以将它用作一元运算符......
You can use the << and >> operators, and you have to specify how many bits to shift.
You can also use it as a unary operator...