VB6位運算 - lyserver(CSDN) 轉載
- Public Function SHL(nSource As Long, n As Byte) As Long
- SHL = nSource * 2 ^ n
- End Function
-
- Public Function SHR(nSource As Long, n As Byte) As Long
- SHR = nSource / 2 ^ n
- End Function
-
- Public Function GetBits(nSource As Long, n As Byte) As Boolean
- GetBits = nSource And 2 ^ n
- End Function
-
- Public Function SetBits(nSource As Long, n As Byte) As Long
- SetBits = nSource Or 2 ^ n
- End Function
-
- Public Function ResetBits(nSource As Long, n As Byte) As Long
- ResetBits = nSource And Not 2 ^ n
- End Function
歡迎關注本站公眾號,獲取更多信息