【VB6】将“十进制”转换为二进制字符串的函数
应需给人帮忙写了这份代码,经过测试没有发现问题。个人觉得性能上来说,应该难以被超越了,除非用Detour等方式自己hook自己,然后插入shellcode。Function Dec2Bin(ByVal Num As Long) As String
Dim Result() As Byte, Pos As Long, I As Long
ReDim Result(63)
If Num And &H1& Then Result(62) = &H31 Else Result(62) = &H30
If Num And &H2& Then Result(60) = &H31 Else Result(60) = &H30
If Num And &H4& Then Result(58) = &H31 Else Result(58) = &H30
If Num And &H8& Then Result(56) = &H31 Else Result(56) = &H30
If Num And &H10& Then Result(54) = &H31 Else Result(54) = &H30
If Num And &H20& Then Result(52) = &H31 Else Result(52) = &H30
If Num And &H40& Then Result(50) = &H31 Else Result(50) = &H30
If Num And &H80& Then Result(48) = &H31 Else Result(48) = &H30
If Num And &H100& Then Result(46) = &H31 Else Result(46) = &H30
If Num And &H200& Then Result(44) = &H31 Else Result(44) = &H30
If Num And &H400& Then Result(42) = &H31 Else Result(42) = &H30
If Num And &H800& Then Result(40) = &H31 Else Result(40) = &H30
If Num And &H1000& Then Result(38) = &H31 Else Result(38) = &H30
If Num And &H2000& Then Result(36) = &H31 Else Result(36) = &H30
If Num And &H4000& Then Result(34) = &H31 Else Result(34) = &H30
If Num And &H8000& Then Result(32) = &H31 Else Result(32) = &H30
If Num And &H10000 Then Result(30) = &H31 Else Result(30) = &H30
If Num And &H20000 Then Result(28) = &H31 Else Result(28) = &H30
If Num And &H40000 Then Result(26) = &H31 Else Result(26) = &H30
If Num And &H80000 Then Result(24) = &H31 Else Result(24) = &H30
If Num And &H100000 Then Result(22) = &H31 Else Result(22) = &H30
If Num And &H200000 Then Result(20) = &H31 Else Result(20) = &H30
If Num And &H400000 Then Result(18) = &H31 Else Result(18) = &H30
If Num And &H800000 Then Result(16) = &H31 Else Result(16) = &H30
If Num And &H1000000 Then Result(14) = &H31 Else Result(14) = &H30
If Num And &H2000000 Then Result(12) = &H31 Else Result(12) = &H30
If Num And &H4000000 Then Result(10) = &H31 Else Result(10) = &H30
If Num And &H8000000 Then Result(8) = &H31 Else Result(8) = &H30
If Num And &H10000000 Then Result(6) = &H31 Else Result(6) = &H30
If Num And &H20000000 Then Result(4) = &H31 Else Result(4) = &H30
If Num And &H40000000 Then Result(2) = &H31 Else Result(2) = &H30
If Num And &H80000000 Then Result(0) = &H31 Else Result(0) = &H30
Dec2Bin = Result
End Function我一直想吐槽的几个点:
[*]输入的参数是个Long,而它并不是“十进制”,而是一个32位的有符号整数类型,在CPU中或者内存中都是以32位二进制的方式存储的。我并没有看出任何“十进制”的地方。
对于“十进制”的说法,其实有个打擦边球的数据类型,叫“BCD数”,它用4个二进制位存储一个10进制位表示的数值。但即便如此,VB6的Long它也不是BCD数。
所以实际上根本不存在什么转换。只需要检测Long里面的每一个bit是否为1,然后处理字符串即可。
[*]把一个数值类型的变量以十进制字符串的方式存储或者显示的时候,你需要通过不断除以10求余数和商来判断出它作为十进制的时候每个位的数值是多少。
同样我也见过有人把Long的数值除以2,然后判断余数是不是1来得出这个位是否为1。但这种做法存在一个问题。那就是CPU做整数除法的运算其实是相当慢的,尤其是有符号整数除法,运算速率甚至比不过浮点数除法。
判断二进制的每个位的数值,最简单的办法就是用逻辑与来筛选。为何要做除法运算?
[*]Long的长度就是32个二进制位,毕竟VB6不会再有什么长进了。它的数据类型,线程结构,能用到的指令集,已经固定。Long也不会变得更长。因此,为何要使用循环语句?VB6的编译器会老老实实地做循环判断跳转的过程,而现在的CPU都不喜欢跳转指令——它意味着指令队列刷新,相当于要多浪费几个指令的周期来填满它的流水线。
所以我直接写32条语句来判断它每一个bit的状态,并修改字符串中对应位置的字符。
[*]VB6的字符串操作过程,尤其是字符串拼接的过程,每次都会造成内存分配和释放。众所周知,内存分配,它慢。频繁的内存分配是造成各种算法的性能瓶颈的理由。
所以对于 If xxxx Then A = A & "1" Else A = A & "0" 这样的写法,每次执行的时候VB6为了存储A的字符串值,会给它重新分配内存然后在它尾部追加"1"或者"0"。
这怎么可能快得起来呢?VB6字符串处理里最慢的基本上就是字符串拼接了。
Dim x As Long : x = &H55555555
Dim s As String : s = String(32, 48)
While x <> 0
Select Case (x And ( - x))
Case 1 : s = 49
Case 2 : s = 49
Case 4 : s = 49
Case 8 : s = 49
Case &H10 : s = 49
Case &H20 : s = 49
Case &H40 : s = 49
Case &H80 : s = 49
Case &H100 : s = 49
Case &H200 : s = 49
Case &H400 : s = 49
Case &H800 : s = 49
Case &H1000 : s = 49
Case &H2000 : s = 49
Case &H4000 : s = 49
Case &H8000 : s = 49
Case &H10000 : s = 49
Case &H20000 : s = 49
Case &H40000 : s = 49
Case &H80000 : s = 49
Case &H100000 : s = 49
Case &H200000 : s = 49
Case &H400000 : s = 49
Case &H800000 : s = 49
Case &H1000000 : s = 49
Case &H2000000 : s = 49
Case &H4000000 : s = 49
Case &H8000000 : s = 49
Case &H10000000 : s = 49
Case &H20000000 : s = 49
Case &H40000000 : s = 49
Case &H80000000 : s = 49
End Select
x = (x And (x - 1))
Wend
Debug.Print s !!!谢谢A5. 本帖最后由 Ayala 于 2019-7-10 23:32 编辑
函数整体应该是十进制字符串处理成二进制字符串 不过vb可以很“神奇”的自动把"1"转换为 byval 1
传递的参数都已经是long了 用字典处理会不会更快些
"0000","0001","0010","0011","0100","0101","0110","0111",_
"1000","1001","1010","1011","1100","1101","1110","1111"
定义16个就够了
/Fo输出下asm看看
TITLE C:\Users\Administrator\Desktop\Form1.frm
.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS ENDS
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS ENDS
text$1 SEGMENT PARA USE32 PUBLIC ''
text$1 ENDS
; COMDAT ?Dec2Bin@Form1@@AAGXXZ
text$1 SEGMENT PARA USE32 PUBLIC ''
text$1 ENDS
; COMDAT ?Form_Load@Form1@@AAGXXZ
text$1 SEGMENT PARA USE32 PUBLIC ''
text$1 ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
PUBLIC ?Dec2Bin@Form1@@AAGXXZ ; Form1::Dec2Bin
EXTRN __imp____vbaRedim:NEAR
EXTRN __imp____vbaGenerateBoundsError:NEAR
EXTRN __imp_@__vbaUI1I2:NEAR
EXTRN __imp_@__vbaStrMove:NEAR
EXTRN __imp____vbaStrVarCopy:NEAR
EXTRN __imp_@__vbaFreeStr:NEAR
EXTRN __imp____vbaAryDestruct:NEAR
EXTRN ___vbaExceptHandler:NEAR
EXTRN __except_list:DWORD
; COMDAT CONST
; File C:\Users\Administrator\Desktop\Form1.frm
CONST SEGMENT
$S33 DB 0bH, 00H
DB 08H, 00H
DD FLAT:$L32
DD FLAT:$L30
DD FLAT:$L31
CONST ENDS
; COMDAT ?Dec2Bin@Form1@@AAGXXZ
text$1 SEGMENT
_Me$ = 8
_Dec2Bin$ = 16
_Num$ = 12
_Result$ = -32
_Dec2Bin$ = -36
_unnamed_var1$ = -52
__$SEHRec$ = -20
?Dec2Bin@Form1@@AAGXXZ PROC NEAR ; Form1::Dec2Bin, COMDAT
; File C:\Users\Administrator\Desktop\Form1.frm
; Line 18
push ebp
mov ebp, esp
sub esp, 12 ; 0000000cH
push OFFSET FLAT:___vbaExceptHandler
mov eax, DWORD PTR fs:__except_list
push eax
mov DWORD PTR fs:__except_list, esp
sub esp, 44 ; 0000002cH
push ebx
push esi
push edi
mov DWORD PTR __$SEHRec$, esp
mov DWORD PTR __$SEHRec$, OFFSET FLAT:$S33
xor esi, esi
mov DWORD PTR __$SEHRec$, esi
mov eax, DWORD PTR _Me$
push eax
mov ecx, DWORD PTR
call DWORD PTR
mov edx, DWORD PTR _Dec2Bin$
; Line 20
push esi
push 63 ; 0000003fH
push 1
lea eax, DWORD PTR _Result$
push 17 ; 00000011H
push eax
push 1
push 128 ; 00000080H
mov DWORD PTR _Result$, esi
mov DWORD PTR _Dec2Bin$, esi
mov DWORD PTR _unnamed_var1$, esi
mov DWORD PTR , esi
call DWORD PTR __imp____vbaRedim
; Line 22
mov al, BYTE PTR _Num$
add esp, 28 ; 0000001cH
test al, 1
mov eax, DWORD PTR _Result$
je SHORT $L35
cmp eax, esi
je SHORT $L141
cmp WORD PTR , 1
jne SHORT $L141
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov ebx, DWORD PTR __imp____vbaGenerateBoundsError
mov esi, 62 ; 0000003eH
sub esi, edx
cmp esi, ecx
jb SHORT $L144
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L408
$L141:
mov ebx, DWORD PTR __imp____vbaGenerateBoundsError
call ebx
mov esi, eax
$L144:
mov ecx, 49 ; 00000031H
jmp SHORT $L408
$L35:
cmp eax, esi
je SHORT $L145
cmp WORD PTR , 1
jne SHORT $L145
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov ebx, DWORD PTR __imp____vbaGenerateBoundsError
mov esi, 62 ; 0000003eH
sub esi, edx
cmp esi, ecx
jb SHORT $L148
call ebx
jmp SHORT $L148
$L145:
mov ebx, DWORD PTR __imp____vbaGenerateBoundsError
call ebx
mov esi, eax
$L148:
mov ecx, 48 ; 00000030H
$L408:
mov edi, DWORD PTR __imp_@__vbaUI1I2
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 23
mov al, BYTE PTR _Num$
test al, 2
mov eax, DWORD PTR _Result$
je SHORT $L39
test eax, eax
je SHORT $L149
cmp WORD PTR , 1
jne SHORT $L149
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 60 ; 0000003cH
sub esi, edx
cmp esi, ecx
jb SHORT $L152
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L409
$L149:
call ebx
mov esi, eax
$L152:
mov ecx, 49 ; 00000031H
jmp SHORT $L409
$L39:
test eax, eax
je SHORT $L153
cmp WORD PTR , 1
jne SHORT $L153
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 60 ; 0000003cH
sub esi, edx
cmp esi, ecx
jb SHORT $L156
call ebx
jmp SHORT $L156
$L153:
call ebx
mov esi, eax
$L156:
mov ecx, 48 ; 00000030H
$L409:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 24
mov al, BYTE PTR _Num$
test al, 4
mov eax, DWORD PTR _Result$
je SHORT $L41
test eax, eax
je SHORT $L157
cmp WORD PTR , 1
jne SHORT $L157
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 58 ; 0000003aH
sub esi, edx
cmp esi, ecx
jb SHORT $L160
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L410
$L157:
call ebx
mov esi, eax
$L160:
mov ecx, 49 ; 00000031H
jmp SHORT $L410
$L41:
test eax, eax
je SHORT $L161
cmp WORD PTR , 1
jne SHORT $L161
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 58 ; 0000003aH
sub esi, edx
cmp esi, ecx
jb SHORT $L164
call ebx
jmp SHORT $L164
$L161:
call ebx
mov esi, eax
$L164:
mov ecx, 48 ; 00000030H
$L410:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 25
mov al, BYTE PTR _Num$
test al, 8
mov eax, DWORD PTR _Result$
je SHORT $L43
test eax, eax
je SHORT $L165
cmp WORD PTR , 1
jne SHORT $L165
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 56 ; 00000038H
sub esi, edx
cmp esi, ecx
jb SHORT $L168
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L411
$L165:
call ebx
mov esi, eax
$L168:
mov ecx, 49 ; 00000031H
jmp SHORT $L411
$L43:
test eax, eax
je SHORT $L169
cmp WORD PTR , 1
jne SHORT $L169
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 56 ; 00000038H
sub esi, edx
cmp esi, ecx
jb SHORT $L172
call ebx
jmp SHORT $L172
$L169:
call ebx
mov esi, eax
$L172:
mov ecx, 48 ; 00000030H
$L411:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 26
mov al, BYTE PTR _Num$
test al, 16 ; 00000010H
mov eax, DWORD PTR _Result$
je SHORT $L45
test eax, eax
je SHORT $L173
cmp WORD PTR , 1
jne SHORT $L173
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 54 ; 00000036H
sub esi, edx
cmp esi, ecx
jb SHORT $L176
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L412
$L173:
call ebx
mov esi, eax
$L176:
mov ecx, 49 ; 00000031H
jmp SHORT $L412
$L45:
test eax, eax
je SHORT $L177
cmp WORD PTR , 1
jne SHORT $L177
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 54 ; 00000036H
sub esi, edx
cmp esi, ecx
jb SHORT $L180
call ebx
jmp SHORT $L180
$L177:
call ebx
mov esi, eax
$L180:
mov ecx, 48 ; 00000030H
$L412:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 27
mov al, BYTE PTR _Num$
test al, 32 ; 00000020H
mov eax, DWORD PTR _Result$
je SHORT $L47
test eax, eax
je SHORT $L181
cmp WORD PTR , 1
jne SHORT $L181
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 52 ; 00000034H
sub esi, edx
cmp esi, ecx
jb SHORT $L184
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L413
$L181:
call ebx
mov esi, eax
$L184:
mov ecx, 49 ; 00000031H
jmp SHORT $L413
$L47:
test eax, eax
je SHORT $L185
cmp WORD PTR , 1
jne SHORT $L185
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 52 ; 00000034H
sub esi, edx
cmp esi, ecx
jb SHORT $L188
call ebx
jmp SHORT $L188
$L185:
call ebx
mov esi, eax
$L188:
mov ecx, 48 ; 00000030H
$L413:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 28
mov al, BYTE PTR _Num$
test al, 64 ; 00000040H
mov eax, DWORD PTR _Result$
je SHORT $L49
test eax, eax
je SHORT $L189
cmp WORD PTR , 1
jne SHORT $L189
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 50 ; 00000032H
sub esi, edx
cmp esi, ecx
jb SHORT $L192
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L414
$L189:
call ebx
mov esi, eax
$L192:
mov ecx, 49 ; 00000031H
jmp SHORT $L414
$L49:
test eax, eax
je SHORT $L193
cmp WORD PTR , 1
jne SHORT $L193
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 50 ; 00000032H
sub esi, edx
cmp esi, ecx
jb SHORT $L196
call ebx
jmp SHORT $L196
$L193:
call ebx
mov esi, eax
$L196:
mov ecx, 48 ; 00000030H
$L414:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 29
mov al, BYTE PTR _Num$
test al, -128 ; ffffff80H
mov eax, DWORD PTR _Result$
je SHORT $L51
test eax, eax
je SHORT $L197
cmp WORD PTR , 1
jne SHORT $L197
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 48 ; 00000030H
sub esi, edx
cmp esi, ecx
jb SHORT $L200
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L415
$L197:
call ebx
mov esi, eax
$L200:
mov ecx, 49 ; 00000031H
jmp SHORT $L415
$L51:
test eax, eax
je SHORT $L201
cmp WORD PTR , 1
jne SHORT $L201
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 48 ; 00000030H
sub esi, edx
cmp esi, ecx
jb SHORT $L204
call ebx
jmp SHORT $L204
$L201:
call ebx
mov esi, eax
$L204:
mov ecx, 48 ; 00000030H
$L415:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 30
mov eax, DWORD PTR _Num$
test ah, 1
mov eax, DWORD PTR _Result$
je SHORT $L53
test eax, eax
je SHORT $L205
cmp WORD PTR , 1
jne SHORT $L205
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 46 ; 0000002eH
sub esi, edx
cmp esi, ecx
jb SHORT $L208
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L416
$L205:
call ebx
mov esi, eax
$L208:
mov ecx, 49 ; 00000031H
jmp SHORT $L416
$L53:
test eax, eax
je SHORT $L209
cmp WORD PTR , 1
jne SHORT $L209
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 46 ; 0000002eH
sub esi, edx
cmp esi, ecx
jb SHORT $L212
call ebx
jmp SHORT $L212
$L209:
call ebx
mov esi, eax
$L212:
mov ecx, 48 ; 00000030H
$L416:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 31
mov eax, DWORD PTR _Num$
test ah, 2
mov eax, DWORD PTR _Result$
je SHORT $L55
test eax, eax
je SHORT $L213
cmp WORD PTR , 1
jne SHORT $L213
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 44 ; 0000002cH
sub esi, edx
cmp esi, ecx
jb SHORT $L216
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L417
$L213:
call ebx
mov esi, eax
$L216:
mov ecx, 49 ; 00000031H
jmp SHORT $L417
$L55:
test eax, eax
je SHORT $L217
cmp WORD PTR , 1
jne SHORT $L217
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 44 ; 0000002cH
sub esi, edx
cmp esi, ecx
jb SHORT $L220
call ebx
jmp SHORT $L220
$L217:
call ebx
mov esi, eax
$L220:
mov ecx, 48 ; 00000030H
$L417:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 32
mov eax, DWORD PTR _Num$
test ah, 4
mov eax, DWORD PTR _Result$
je SHORT $L57
test eax, eax
je SHORT $L221
cmp WORD PTR , 1
jne SHORT $L221
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 42 ; 0000002aH
sub esi, edx
cmp esi, ecx
jb SHORT $L224
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L418
$L221:
call ebx
mov esi, eax
$L224:
mov ecx, 49 ; 00000031H
jmp SHORT $L418
$L57:
test eax, eax
je SHORT $L225
cmp WORD PTR , 1
jne SHORT $L225
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 42 ; 0000002aH
sub esi, edx
cmp esi, ecx
jb SHORT $L228
call ebx
jmp SHORT $L228
$L225:
call ebx
mov esi, eax
$L228:
mov ecx, 48 ; 00000030H
$L418:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 33
mov eax, DWORD PTR _Num$
test ah, 8
mov eax, DWORD PTR _Result$
je SHORT $L59
test eax, eax
je SHORT $L229
cmp WORD PTR , 1
jne SHORT $L229
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 40 ; 00000028H
sub esi, edx
cmp esi, ecx
jb SHORT $L232
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L419
$L229:
call ebx
mov esi, eax
$L232:
mov ecx, 49 ; 00000031H
jmp SHORT $L419
$L59:
test eax, eax
je SHORT $L233
cmp WORD PTR , 1
jne SHORT $L233
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 40 ; 00000028H
sub esi, edx
cmp esi, ecx
jb SHORT $L236
call ebx
jmp SHORT $L236
$L233:
call ebx
mov esi, eax
$L236:
mov ecx, 48 ; 00000030H
$L419:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 34
mov eax, DWORD PTR _Num$
test ah, 16 ; 00000010H
mov eax, DWORD PTR _Result$
je SHORT $L61
test eax, eax
je SHORT $L237
cmp WORD PTR , 1
jne SHORT $L237
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 38 ; 00000026H
sub esi, edx
cmp esi, ecx
jb SHORT $L240
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L420
$L237:
call ebx
mov esi, eax
$L240:
mov ecx, 49 ; 00000031H
jmp SHORT $L420
$L61:
test eax, eax
je SHORT $L241
cmp WORD PTR , 1
jne SHORT $L241
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 38 ; 00000026H
sub esi, edx
cmp esi, ecx
jb SHORT $L244
call ebx
jmp SHORT $L244
$L241:
call ebx
mov esi, eax
$L244:
mov ecx, 48 ; 00000030H
$L420:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 35
mov eax, DWORD PTR _Num$
test ah, 32 ; 00000020H
mov eax, DWORD PTR _Result$
je SHORT $L63
test eax, eax
je SHORT $L245
cmp WORD PTR , 1
jne SHORT $L245
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 36 ; 00000024H
sub esi, edx
cmp esi, ecx
jb SHORT $L248
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L421
$L245:
call ebx
mov esi, eax
$L248:
mov ecx, 49 ; 00000031H
jmp SHORT $L421
$L63:
test eax, eax
je SHORT $L249
cmp WORD PTR , 1
jne SHORT $L249
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 36 ; 00000024H
sub esi, edx
cmp esi, ecx
jb SHORT $L252
call ebx
jmp SHORT $L252
$L249:
call ebx
mov esi, eax
$L252:
mov ecx, 48 ; 00000030H
$L421:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 36
mov eax, DWORD PTR _Num$
test ah, 64 ; 00000040H
mov eax, DWORD PTR _Result$
je SHORT $L65
test eax, eax
je SHORT $L253
cmp WORD PTR , 1
jne SHORT $L253
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 34 ; 00000022H
sub esi, edx
cmp esi, ecx
jb SHORT $L256
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L422
$L253:
call ebx
mov esi, eax
$L256:
mov ecx, 49 ; 00000031H
jmp SHORT $L422
$L65:
test eax, eax
je SHORT $L257
cmp WORD PTR , 1
jne SHORT $L257
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 34 ; 00000022H
sub esi, edx
cmp esi, ecx
jb SHORT $L260
call ebx
jmp SHORT $L260
$L257:
call ebx
mov esi, eax
$L260:
mov ecx, 48 ; 00000030H
$L422:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 37
mov eax, DWORD PTR _Num$
test ah, -128 ; ffffff80H
mov eax, DWORD PTR _Result$
je SHORT $L67
test eax, eax
je SHORT $L261
cmp WORD PTR , 1
jne SHORT $L261
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 32 ; 00000020H
sub esi, edx
cmp esi, ecx
jb SHORT $L264
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L423
$L261:
call ebx
mov esi, eax
$L264:
mov ecx, 49 ; 00000031H
jmp SHORT $L423
$L67:
test eax, eax
je SHORT $L265
cmp WORD PTR , 1
jne SHORT $L265
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 32 ; 00000020H
sub esi, edx
cmp esi, ecx
jb SHORT $L268
call ebx
jmp SHORT $L268
$L265:
call ebx
mov esi, eax
$L268:
mov ecx, 48 ; 00000030H
$L423:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 38
mov eax, DWORD PTR _Num$
test eax, 65536 ; 00010000H
mov eax, DWORD PTR _Result$
je SHORT $L69
test eax, eax
je SHORT $L269
cmp WORD PTR , 1
jne SHORT $L269
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 30 ; 0000001eH
sub esi, edx
cmp esi, ecx
jb SHORT $L272
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L424
$L269:
call ebx
mov esi, eax
$L272:
mov ecx, 49 ; 00000031H
jmp SHORT $L424
$L69:
test eax, eax
je SHORT $L273
cmp WORD PTR , 1
jne SHORT $L273
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 30 ; 0000001eH
sub esi, edx
cmp esi, ecx
jb SHORT $L276
call ebx
jmp SHORT $L276
$L273:
call ebx
mov esi, eax
$L276:
mov ecx, 48 ; 00000030H
$L424:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 39
mov eax, DWORD PTR _Num$
test eax, 131072 ; 00020000H
mov eax, DWORD PTR _Result$
je SHORT $L71
test eax, eax
je SHORT $L277
cmp WORD PTR , 1
jne SHORT $L277
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 28 ; 0000001cH
sub esi, edx
cmp esi, ecx
jb SHORT $L280
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L425
$L277:
call ebx
mov esi, eax
$L280:
mov ecx, 49 ; 00000031H
jmp SHORT $L425
$L71:
test eax, eax
je SHORT $L281
cmp WORD PTR , 1
jne SHORT $L281
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 28 ; 0000001cH
sub esi, edx
cmp esi, ecx
jb SHORT $L284
call ebx
jmp SHORT $L284
$L281:
call ebx
mov esi, eax
$L284:
mov ecx, 48 ; 00000030H
$L425:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 40
mov eax, DWORD PTR _Num$
test eax, 262144 ; 00040000H
mov eax, DWORD PTR _Result$
je SHORT $L73
test eax, eax
je SHORT $L285
cmp WORD PTR , 1
jne SHORT $L285
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 26 ; 0000001aH
sub esi, edx
cmp esi, ecx
jb SHORT $L288
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L426
$L285:
call ebx
mov esi, eax
$L288:
mov ecx, 49 ; 00000031H
jmp SHORT $L426
$L73:
test eax, eax
je SHORT $L289
cmp WORD PTR , 1
jne SHORT $L289
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 26 ; 0000001aH
sub esi, edx
cmp esi, ecx
jb SHORT $L292
call ebx
jmp SHORT $L292
$L289:
call ebx
mov esi, eax
$L292:
mov ecx, 48 ; 00000030H
$L426:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 41
mov eax, DWORD PTR _Num$
test eax, 524288 ; 00080000H
mov eax, DWORD PTR _Result$
je SHORT $L75
test eax, eax
je SHORT $L293
cmp WORD PTR , 1
jne SHORT $L293
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 24 ; 00000018H
sub esi, edx
cmp esi, ecx
jb SHORT $L296
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L427
$L293:
call ebx
mov esi, eax
$L296:
mov ecx, 49 ; 00000031H
jmp SHORT $L427
$L75:
test eax, eax
je SHORT $L297
cmp WORD PTR , 1
jne SHORT $L297
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 24 ; 00000018H
sub esi, edx
cmp esi, ecx
jb SHORT $L300
call ebx
jmp SHORT $L300
$L297:
call ebx
mov esi, eax
$L300:
mov ecx, 48 ; 00000030H
$L427:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 42
mov eax, DWORD PTR _Num$
test eax, 1048576 ; 00100000H
mov eax, DWORD PTR _Result$
je SHORT $L77
test eax, eax
je SHORT $L301
cmp WORD PTR , 1
jne SHORT $L301
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 22 ; 00000016H
sub esi, edx
cmp esi, ecx
jb SHORT $L304
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L428
$L301:
call ebx
mov esi, eax
$L304:
mov ecx, 49 ; 00000031H
jmp SHORT $L428
$L77:
test eax, eax
je SHORT $L305
cmp WORD PTR , 1
jne SHORT $L305
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 22 ; 00000016H
sub esi, edx
cmp esi, ecx
jb SHORT $L308
call ebx
jmp SHORT $L308
$L305:
call ebx
mov esi, eax
$L308:
mov ecx, 48 ; 00000030H
$L428:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 43
mov eax, DWORD PTR _Num$
test eax, 2097152 ; 00200000H
mov eax, DWORD PTR _Result$
je SHORT $L79
test eax, eax
je SHORT $L309
cmp WORD PTR , 1
jne SHORT $L309
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 20 ; 00000014H
sub esi, edx
cmp esi, ecx
jb SHORT $L312
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L429
$L309:
call ebx
mov esi, eax
$L312:
mov ecx, 49 ; 00000031H
jmp SHORT $L429
$L79:
test eax, eax
je SHORT $L313
cmp WORD PTR , 1
jne SHORT $L313
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 20 ; 00000014H
sub esi, edx
cmp esi, ecx
jb SHORT $L316
call ebx
jmp SHORT $L316
$L313:
call ebx
mov esi, eax
$L316:
mov ecx, 48 ; 00000030H
$L429:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 44
mov eax, DWORD PTR _Num$
test eax, 4194304 ; 00400000H
mov eax, DWORD PTR _Result$
je SHORT $L81
test eax, eax
je SHORT $L317
cmp WORD PTR , 1
jne SHORT $L317
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 18 ; 00000012H
sub esi, edx
cmp esi, ecx
jb SHORT $L320
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L430
$L317:
call ebx
mov esi, eax
$L320:
mov ecx, 49 ; 00000031H
jmp SHORT $L430
$L81:
test eax, eax
je SHORT $L321
cmp WORD PTR , 1
jne SHORT $L321
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 18 ; 00000012H
sub esi, edx
cmp esi, ecx
jb SHORT $L324
call ebx
jmp SHORT $L324
$L321:
call ebx
mov esi, eax
$L324:
mov ecx, 48 ; 00000030H
$L430:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 45
mov eax, DWORD PTR _Num$
test eax, 8388608 ; 00800000H
mov eax, DWORD PTR _Result$
je SHORT $L83
test eax, eax
je SHORT $L325
cmp WORD PTR , 1
jne SHORT $L325
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 16 ; 00000010H
sub esi, edx
cmp esi, ecx
jb SHORT $L328
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L431
$L325:
call ebx
mov esi, eax
$L328:
mov ecx, 49 ; 00000031H
jmp SHORT $L431
$L83:
test eax, eax
je SHORT $L329
cmp WORD PTR , 1
jne SHORT $L329
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 16 ; 00000010H
sub esi, edx
cmp esi, ecx
jb SHORT $L332
call ebx
jmp SHORT $L332
$L329:
call ebx
mov esi, eax
$L332:
mov ecx, 48 ; 00000030H
$L431:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 46
mov eax, DWORD PTR _Num$
test eax, 16777216 ; 01000000H
mov eax, DWORD PTR _Result$
je SHORT $L85
test eax, eax
je SHORT $L333
cmp WORD PTR , 1
jne SHORT $L333
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 14 ; 0000000eH
sub esi, edx
cmp esi, ecx
jb SHORT $L336
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L432
$L333:
call ebx
mov esi, eax
$L336:
mov ecx, 49 ; 00000031H
jmp SHORT $L432
$L85:
test eax, eax
je SHORT $L337
cmp WORD PTR , 1
jne SHORT $L337
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 14 ; 0000000eH
sub esi, edx
cmp esi, ecx
jb SHORT $L340
call ebx
jmp SHORT $L340
$L337:
call ebx
mov esi, eax
$L340:
mov ecx, 48 ; 00000030H
$L432:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 47
mov eax, DWORD PTR _Num$
test eax, 33554432 ; 02000000H
mov eax, DWORD PTR _Result$
je SHORT $L87
test eax, eax
je SHORT $L341
cmp WORD PTR , 1
jne SHORT $L341
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 12 ; 0000000cH
sub esi, edx
cmp esi, ecx
jb SHORT $L344
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L433
$L341:
call ebx
mov esi, eax
$L344:
mov ecx, 49 ; 00000031H
jmp SHORT $L433
$L87:
test eax, eax
je SHORT $L345
cmp WORD PTR , 1
jne SHORT $L345
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 12 ; 0000000cH
sub esi, edx
cmp esi, ecx
jb SHORT $L348
call ebx
jmp SHORT $L348
$L345:
call ebx
mov esi, eax
$L348:
mov ecx, 48 ; 00000030H
$L433:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 48
mov eax, DWORD PTR _Num$
test eax, 67108864 ; 04000000H
mov eax, DWORD PTR _Result$
je SHORT $L89
test eax, eax
je SHORT $L349
cmp WORD PTR , 1
jne SHORT $L349
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 10 ; 0000000aH
sub esi, edx
cmp esi, ecx
jb SHORT $L352
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L434
$L349:
call ebx
mov esi, eax
$L352:
mov ecx, 49 ; 00000031H
jmp SHORT $L434
$L89:
test eax, eax
je SHORT $L353
cmp WORD PTR , 1
jne SHORT $L353
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 10 ; 0000000aH
sub esi, edx
cmp esi, ecx
jb SHORT $L356
call ebx
jmp SHORT $L356
$L353:
call ebx
mov esi, eax
$L356:
mov ecx, 48 ; 00000030H
$L434:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 49
mov eax, DWORD PTR _Num$
test eax, 134217728 ; 08000000H
mov eax, DWORD PTR _Result$
je SHORT $L91
test eax, eax
je SHORT $L357
cmp WORD PTR , 1
jne SHORT $L357
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 8
sub esi, edx
cmp esi, ecx
jb SHORT $L360
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L435
$L357:
call ebx
mov esi, eax
$L360:
mov ecx, 49 ; 00000031H
jmp SHORT $L435
$L91:
test eax, eax
je SHORT $L361
cmp WORD PTR , 1
jne SHORT $L361
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 8
sub esi, edx
cmp esi, ecx
jb SHORT $L364
call ebx
jmp SHORT $L364
$L361:
call ebx
mov esi, eax
$L364:
mov ecx, 48 ; 00000030H
$L435:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 50
mov eax, DWORD PTR _Num$
test eax, 268435456 ; 10000000H
mov eax, DWORD PTR _Result$
je SHORT $L93
test eax, eax
je SHORT $L365
cmp WORD PTR , 1
jne SHORT $L365
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 6
sub esi, edx
cmp esi, ecx
jb SHORT $L368
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L436
$L365:
call ebx
mov esi, eax
$L368:
mov ecx, 49 ; 00000031H
jmp SHORT $L436
$L93:
test eax, eax
je SHORT $L369
cmp WORD PTR , 1
jne SHORT $L369
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 6
sub esi, edx
cmp esi, ecx
jb SHORT $L372
call ebx
jmp SHORT $L372
$L369:
call ebx
mov esi, eax
$L372:
mov ecx, 48 ; 00000030H
$L436:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 51
mov eax, DWORD PTR _Num$
test eax, 536870912 ; 20000000H
mov eax, DWORD PTR _Result$
je SHORT $L95
test eax, eax
je SHORT $L373
cmp WORD PTR , 1
jne SHORT $L373
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 4
sub esi, edx
cmp esi, ecx
jb SHORT $L376
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L437
$L373:
call ebx
mov esi, eax
$L376:
mov ecx, 49 ; 00000031H
jmp SHORT $L437
$L95:
test eax, eax
je SHORT $L377
cmp WORD PTR , 1
jne SHORT $L377
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 4
sub esi, edx
cmp esi, ecx
jb SHORT $L380
call ebx
jmp SHORT $L380
$L377:
call ebx
mov esi, eax
$L380:
mov ecx, 48 ; 00000030H
$L437:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 52
mov eax, DWORD PTR _Num$
test eax, 1073741824 ; 40000000H
mov eax, DWORD PTR _Result$
je SHORT $L97
test eax, eax
je SHORT $L381
cmp WORD PTR , 1
jne SHORT $L381
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 2
sub esi, edx
cmp esi, ecx
jb SHORT $L384
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L438
$L381:
call ebx
mov esi, eax
$L384:
mov ecx, 49 ; 00000031H
jmp SHORT $L438
$L97:
test eax, eax
je SHORT $L385
cmp WORD PTR , 1
jne SHORT $L385
mov edx, DWORD PTR
mov ecx, DWORD PTR
mov esi, 2
sub esi, edx
cmp esi, ecx
jb SHORT $L388
call ebx
jmp SHORT $L388
$L385:
call ebx
mov esi, eax
$L388:
mov ecx, 48 ; 00000030H
$L438:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
mov BYTE PTR , al
; Line 53
mov eax, DWORD PTR _Num$
test eax, -2147483648 ; 80000000H
mov eax, DWORD PTR _Result$
je SHORT $L99
test eax, eax
je SHORT $L389
cmp WORD PTR , 1
jne SHORT $L389
mov esi, DWORD PTR
mov ecx, DWORD PTR
neg esi
cmp esi, ecx
jb SHORT $L392
call ebx
mov ecx, 49 ; 00000031H
jmp SHORT $L439
$L389:
call ebx
mov esi, eax
$L392:
mov ecx, 49 ; 00000031H
jmp SHORT $L439
$L99:
test eax, eax
je SHORT $L393
cmp WORD PTR , 1
jne SHORT $L393
mov esi, DWORD PTR
mov ecx, DWORD PTR
neg esi
cmp esi, ecx
jb SHORT $L396
call ebx
jmp SHORT $L396
$L393:
call ebx
mov esi, eax
$L396:
mov ecx, 48 ; 00000030H
$L439:
call edi
mov ecx, DWORD PTR _Result$
mov edx, DWORD PTR
; Line 55
lea ecx, DWORD PTR _unnamed_var1$
push ecx
mov BYTE PTR , al
mov eax, DWORD PTR _Result$
mov DWORD PTR _unnamed_var1$, eax
mov DWORD PTR _unnamed_var1$, 8209 ; 00002011H
call DWORD PTR __imp____vbaStrVarCopy
mov edx, eax
lea ecx, DWORD PTR _Dec2Bin$
call DWORD PTR __imp_@__vbaStrMove
$L32:
push $L402
jmp SHORT $L397
$L31:
; Line 56
lea ecx, DWORD PTR _Dec2Bin$
call DWORD PTR __imp_@__vbaFreeStr
ret 0
$L397:
$L30:
lea edx, DWORD PTR _Result$
push edx
push 0
call DWORD PTR __imp____vbaAryDestruct
$L400:
ret 0
$L402:
mov eax, DWORD PTR _Me$
push eax
mov ecx, DWORD PTR
call DWORD PTR
mov edx, DWORD PTR _Dec2Bin$
mov eax, DWORD PTR _Dec2Bin$
mov DWORD PTR , eax
mov eax, DWORD PTR __$SEHRec$
mov ecx, DWORD PTR __$SEHRec$
pop edi
pop esi
mov DWORD PTR fs:__except_list, ecx
pop ebx
mov esp, ebp
pop ebp
ret 12 ; 0000000cH
?Dec2Bin@Form1@@AAGXXZ ENDP ; Form1::Dec2Bin
text$1 ENDS
PUBLIC ?Form_Load@Form1@@AAGXXZ ; Form1::Form_Load
EXTRN __imp____vba@051DF814:NEAR
EXTRN __imp____vbaHresultCheckObj:NEAR
EXTRN ___vba@006A2A78:BYTE
EXTRN __imp____vbaFreeVarList:NEAR
; COMDAT CONST
; File C:\Users\Administrator\Desktop\Form1.frm
CONST SEGMENT
$S120 DB 05H, 00H
DB 08H, 00H
DD FLAT:$L119
DB 00H, 00H, 00H, 00H
DD FLAT:$L118
CONST ENDS
; COMDAT ?Form_Load@Form1@@AAGXXZ
text$1 SEGMENT
_Me$ = 8
_unnamed_var1$ = -24
_unnamed_var1$ = -40
_unnamed_var1$ = -56
_unnamed_var1$ = -72
_unnamed_var1$ = -88
__$SEHRec$ = -20
?Form_Load@Form1@@AAGXXZ PROC NEAR ; Form1::Form_Load, COMDAT
; File C:\Users\Administrator\Desktop\Form1.frm
; Line 58
push ebp
mov ebp, esp
sub esp, 12 ; 0000000cH
push OFFSET FLAT:___vbaExceptHandler
mov eax, DWORD PTR fs:__except_list
push eax
mov DWORD PTR fs:__except_list, esp
sub esp, 132 ; 00000084H
push ebx
push esi
push edi
mov DWORD PTR __$SEHRec$, esp
mov DWORD PTR __$SEHRec$, OFFSET FLAT:$S120
mov esi, DWORD PTR _Me$
mov eax, esi
and eax, 1
mov DWORD PTR __$SEHRec$, eax
and esi, -2 ; fffffffeH
push esi
mov DWORD PTR _Me$, esi
mov ecx, DWORD PTR
call DWORD PTR
; Line 59
mov edx, DWORD PTR
xor edi, edi
mov eax, 10 ; 0000000aH
mov DWORD PTR _unnamed_var1$, edi
mov DWORD PTR _unnamed_var1$, edi
mov DWORD PTR _unnamed_var1$, edi
mov DWORD PTR _unnamed_var1$, eax
mov DWORD PTR _unnamed_var1$, eax
mov DWORD PTR _unnamed_var1$, eax
lea eax, DWORD PTR _unnamed_var1$
push eax
mov ecx, -2147352572 ; 80020004H
push 1
push esi
mov DWORD PTR _unnamed_var1$, edi
mov DWORD PTR _unnamed_var1$, edi
mov DWORD PTR _unnamed_var1$, ecx
mov DWORD PTR _unnamed_var1$, ecx
mov DWORD PTR _unnamed_var1$, ecx
call DWORD PTR
cmp eax, edi
jge SHORT $L443
push 1784 ; 000006f8H
push OFFSET FLAT:___vba@006A2A78
push esi
push eax
call DWORD PTR __imp____vbaHresultCheckObj
$L443:
mov eax, DWORD PTR _unnamed_var1$
lea ecx, DWORD PTR _unnamed_var1$
mov DWORD PTR _unnamed_var1$, eax
lea edx, DWORD PTR _unnamed_var1$
push ecx
lea eax, DWORD PTR _unnamed_var1$
push edx
push eax
lea ecx, DWORD PTR _unnamed_var1$
push edi
push ecx
mov DWORD PTR _unnamed_var1$, edi
mov DWORD PTR _unnamed_var1$, 8
call DWORD PTR __imp____vba@051DF814
lea edx, DWORD PTR _unnamed_var1$
lea eax, DWORD PTR _unnamed_var1$
push edx
lea ecx, DWORD PTR _unnamed_var1$
push eax
lea edx, DWORD PTR _unnamed_var1$
push ecx
push edx
push 4
call DWORD PTR __imp____vbaFreeVarList
add esp, 20 ; 00000014H
; Line 60
mov DWORD PTR __$SEHRec$, edi
$L119:
push $L450
jmp SHORT $L445
$L118:
lea ecx, DWORD PTR _unnamed_var1$
call DWORD PTR __imp_@__vbaFreeStr
lea eax, DWORD PTR _unnamed_var1$
lea ecx, DWORD PTR _unnamed_var1$
push eax
lea edx, DWORD PTR _unnamed_var1$
push ecx
lea eax, DWORD PTR _unnamed_var1$
push edx
push eax
push 4
call DWORD PTR __imp____vbaFreeVarList
add esp, 20 ; 00000014H
ret 0
$L445:
$L448:
ret 0
$L450:
mov eax, DWORD PTR _Me$
push eax
mov ecx, DWORD PTR
call DWORD PTR
mov eax, DWORD PTR __$SEHRec$
mov ecx, DWORD PTR __$SEHRec$
pop edi
pop esi
mov DWORD PTR fs:__except_list, ecx
pop ebx
mov esp, ebp
pop ebp
ret 4
?Form_Load@Form1@@AAGXXZ ENDP ; Form1::Form_Load
text$1 ENDS
END
本帖最后由 Ayala 于 2019-7-11 20:17 编辑
伪代码 不知道速度怎样 太多年不写vb了 不知道怎么玩了
Dim s() As String
Dim nums(4) As Byte
s() = Array("00000000", "00000001", "00000010", "00000011", "00000100", "00000101", "00000110", "00000111", _
"00001000", "00001001", "00001010", "00001011", "00001100", "00001101", "00001110", "00001111", _
...
"11111111")
memcpy nums(0),num
d2cbin =s(nums(3)) & s(nums(2)) & s(nums(1)) & (nums(0))
Dec2Bin = Result Ayala 发表于 2019-7-11 20:02
伪代码 不知道速度怎样 太多年不写vb了 不知道怎么玩了
Dim s() As String
Dim nums(4) As Byte
这个是最快的。但这个表的初始化不能重复执行。
我测试过65536个表项的,并且使用整数除法而非CopyMemory等玩意儿。
确实查表法是最快的。 本帖最后由 Ayala 于 2019-7-14 19:25 编辑
0xAA55 发表于 2019-7-13 15:58
这个是最快的。但这个表的初始化不能重复执行。
我测试过65536个表项的,并且使用整数除法而非CopyMemor ...
65536个就太占内存了不是很必要256个就可以处理任意位数的16进制数据了,可以不用copymemeory,可以利用vb的__vbaCopyBytes或者直接GetMem4 老外的原始代码如下:
Public Static Function Dec2Bin(ByVal L As Long) As String
' by Peter Nierop, pnierop.pnc@inter.nl.net, 20001226
Dim lDone&, sNibble(0 To 15) As String, sByte(0 To 255) As String
If lDone = 0 Then
sNibble(0) = "0000"
sNibble(1) = "0001"
sNibble(2) = "0010"
sNibble(3) = "0011"
sNibble(4) = "0100"
sNibble(5) = "0101"
sNibble(6) = "0110"
sNibble(7) = "0111"
sNibble(8) = "1000"
sNibble(9) = "1001"
sNibble(10) = "1010"
sNibble(11) = "1011"
sNibble(12) = "1100"
sNibble(13) = "1101"
sNibble(14) = "1110"
sNibble(15) = "1111"
For lDone = 0 To 255
sByte(lDone) = sNibble(lDone \ &H10) & sNibble(lDone And &HF)
Next
End If
If L < 0 Then
L = L And &H7FFFFFFF
Dec2Bin = sByte(128 + L \ &H1000000 And &HFF) _
& sByte(L \ &H10000 And &HFF) _
& sByte(L \ &H100 And &HFF) _
& sByte(L And &HFF)
Else
Dec2Bin = sByte(L \ &H1000000 And &HFF) _
& sByte(L \ &H10000 And &HFF) _
& sByte(L \ &H100 And &HFF) _
& sByte(L And &HFF)
End If
End Function 搬砖工 发表于 2019-7-20 17:31
老外的原始代码如下:
Public Static Function Dec2Bin(ByVal L As Long) As String
...
这个效率并不如楼主的效率高 Ayala 发表于 2019-7-20 19:49
这个效率并不如楼主的效率高
不知道你比没比过,我比了一下好像我这个比楼主的效率高一些。
用的CPU计时器记录时间
谢谢楼主无私分享 tlwh163 发表于 2023-4-28 18:48
Dim x As Long : x = &H55555555
Dim s As String : s = String(32, 48)
...
你这个代码是 ChatGPT 给你回答的吧,根本就不符合 VB 的语法。
VB 哪有用 [] 运算符来修改字符串里面的字符的写法呢?
以及,Case &H8000 的那句,实际上你是在判断 (x And ( - x)) 的值是否为 &HFFFF8000。你不知道 VB6 默认使用更小的整数类型,而对整数长度进行扩展的时候,用的是符号扩展。 ...这可是我自己想的思路 网上有这样的代码吗?
最近正好在鼓捣显示二进制01字符串的事 就发了下自己的想法
手头没有VB6 用VFB写的
至于你说的2个问题 也是可以修正的
1.值域的问题 &H8000&
2.[]的问题 mid(s,16,1) = "1"
大概是这样吧
tlwh163 发表于 2023-4-29 21:30
...这可是我自己想的思路 网上有这样的代码吗?
最近正好在鼓捣显示二进制01字符串的事 就发了下自己的想法 ...
1、值域问题对的。
2、不如用 Byte 数组赋值,然后直接把 Byte 数组赋值给 String
页:
[1]