DWORD bitmask = 0x80000000;
for (i = 0; i < m; i++) { //m是左移的位数
if (a >= bitmask) a -= bitmask;
bitmask = bitmask / 2;
}
for (i = 0; i < m; i++) {
a = a * 2;
}
If tmp1 <> 0 Then
shl = (x And (tmp \ 2)) * (2 ^ cnt) Or &H80000000 '如果有溢出执行这里
Else
shl = (x And tmp) * (2 ^ cnt) '没有溢出执行这里
End If
End Function
转成二进制字符串的函数
Function bin(ByVal x As Long) As String
Dim i As Integer
Dim f As Long
bin = ""
f = x And &H80000000
x = x And &H7FFFFFFF
For i = 1 To 31
bin = CStr(x Mod 2) & bin
x = x \ 2
Next i
If f <> 0 Then
bin = "1" & bin
Else
bin = "0" & bin
End If
找到解决方法:
Dim x As String, y As Double, d As Double
x = ""
ebp = "6379EC3C"
d = Format("&H" + ebp) + Format("&H" + ebp) * 4
Do While Not d = 0
x = Hex(d - Int(d / &H10000) * &H10000) & x
d = Int(d / &H10000)
Loop
z = Right$(x, 8)
MsgBox z