我在vc++中看到这样语句
x=x shr 1
这条句在VB中怎么表达呀
x=x shr 1
这条句在VB中怎么表达呀
解决方案 »
- listbox中保存多个网址,如何将每个网址的标题都提取出来,然后把取得的标题和网址一一对应写入到listview中
- 我想用全局钩子拦截关机消息(vb)
- 如何灵活控制ProgressBar控件value值的大小?
- 请问如何操作MSCHART控件,具体见内
- 由于,意外掉电,使我的程序里的一个窗体变成了模块,有办法变回来吗?
- 项目启动时的默认form如何可以变换.
- 比较两个字符串的重复率,即答即送分
- 难道是函数调用的错误吗?!
- 一不小心把ACCESS数据库设为了系统数据库!~!~!~!~!~!~!(小弟只能给28分!)
- 如何将数据直接输出到打印端口?
- 怎样能在ListView中显示图片(图标)?
- 简单的删除功能
左移一位:x=x*2
http://www.cx66.com/cxgzs/program/vb/487.htm
Private OnBits(0 To 31) As Long
Public Function LShiftLong(ByVal Value As Long, _
ByVal Shift As Integer) As Long
MakeOnBits
If (Value And (2 ^ (31 - Shift))) Then GoTo OverFlow
LShiftLong = ((Value And OnBits(31 - Shift)) * (2 ^ Shift))
Exit FunctionOverFlow:
LShiftLong = ((Value And OnBits(31 - (Shift + 1))) * _
(2 ^ (Shift))) Or &H80000000
End FunctionPublic Function RShiftLong(ByVal Value As Long, _
ByVal Shift As Integer) As Long
Dim hi As Long
MakeOnBits
If (Value And &H80000000) Then hi = &H40000000
RShiftLong = (Value And &H7FFFFFFE) \ (2 ^ Shift)
RShiftLong = (RShiftLong Or (hi \ (2 ^ (Shift - 1))))
End Function
Public Enum dcShiftDirection
Left = -1
Right = 0
End EnumPublic Function Shift(ByVal lValue As Long, ByVal lNumberOfBitsToShift As Long, ByVal lDirectionToShift As dcShiftDirection) As Long
Const ksCallname As String = "Shift"
On Error GoTo Procedure_Error
Dim LShift As Long
If lDirectionToShift Then 'shift left
LShift = lValue * (2 ^ lNumberOfBitsToShift)
Else 'shift right
LShift = lValue \ (2 ^ lNumberOfBitsToShift)
End If
Procedure_Exit:
Shift = LShift
Exit Function
Procedure_Error:
Err.Raise Err.Number, ksCallname, Err.Description, Err.HelpFile, Err.HelpContext
Resume Procedure_Exit
End FunctionPublic Function LShift(ByVal lValue As Long, ByVal lNumberOfBitsToShift As Long) As Long
Const ksCallname As String = "LShift"
On Error GoTo Procedure_Error
LShift = Shift(lValue, lNumberOfBitsToShift, Left)
Procedure_Exit:
Exit Function
Procedure_Error:
Err.Raise Err.Number, ksCallname, Err.Description, Err.HelpFile, Err.HelpContext
Resume Procedure_Exit
End Function
Public Function RShift(ByVal lValue As Long, ByVal lNumberOfBitsToShift As Long) As Long
Const ksCallname As String = "RShift"
On Error GoTo Procedure_Error
RShift = Shift(lValue, lNumberOfBitsToShift, Right)
Procedure_Exit:
Exit Function
Procedure_Error:
Err.Raise Err.Number, ksCallname, Err.Description, Err.HelpFile, Err.HelpContext
Resume Procedure_Exit
End Function
Private Sub MakeOnBits()
Dim j As Integer, _
v As Long
For j = 0 To 30
v = v + (2 ^ j)
OnBits(j) = v
Next j
OnBits(j) = v + &H80000000End Sub
左移一位:x=x*2
应该是这样的.