- corrected 64 bit assembler code (ebx was not preserved)
- minor optimization git-svn-id: svn://ttmath.org/publicrep/ttmath/branches/chk@147 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
a8c3a506ea
commit
9b576ddbe2
|
@ -3443,13 +3443,13 @@ private:
|
||||||
*/
|
*/
|
||||||
int FromString_ReadScientificIfExists(const tchar_t * & source)
|
int FromString_ReadScientificIfExists(const tchar_t * & source)
|
||||||
{
|
{
|
||||||
int c = 0;
|
uint c = 0;
|
||||||
|
|
||||||
bool scientific_read = false;
|
bool scientific_read = false;
|
||||||
const tchar_t * before_scientific = source;
|
const tchar_t * before_scientific = source;
|
||||||
|
|
||||||
if( FromString_TestScientific(source) )
|
if( FromString_TestScientific(source) )
|
||||||
c += (size_t)FromString_ReadPartScientific( source, scientific_read );
|
c += FromString_ReadPartScientific( source, scientific_read );
|
||||||
|
|
||||||
if( !scientific_read )
|
if( !scientific_read )
|
||||||
source = before_scientific;
|
source = before_scientific;
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace ttmath
|
||||||
|
|
||||||
inc edx
|
inc edx
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz p
|
jnz p
|
||||||
|
|
||||||
setc al
|
setc al
|
||||||
movzx eax, al
|
movzx eax, al
|
||||||
|
@ -192,12 +192,12 @@ namespace ttmath
|
||||||
|
|
||||||
p:
|
p:
|
||||||
add [ebx+edx*4], eax
|
add [ebx+edx*4], eax
|
||||||
jnc end
|
jnc end
|
||||||
|
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
inc edx
|
inc edx
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz p
|
jnz p
|
||||||
|
|
||||||
end:
|
end:
|
||||||
setc al
|
setc al
|
||||||
|
@ -302,12 +302,12 @@ namespace ttmath
|
||||||
|
|
||||||
p:
|
p:
|
||||||
adc [ebx+edx*4], eax
|
adc [ebx+edx*4], eax
|
||||||
jnc end
|
jnc end
|
||||||
|
|
||||||
mov eax, 0
|
mov eax, 0
|
||||||
inc edx
|
inc edx
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz p
|
jnz p
|
||||||
|
|
||||||
end:
|
end:
|
||||||
setc al
|
setc al
|
||||||
|
@ -398,7 +398,7 @@ namespace ttmath
|
||||||
|
|
||||||
inc edx
|
inc edx
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz p
|
jnz p
|
||||||
|
|
||||||
setc al
|
setc al
|
||||||
movzx eax, al
|
movzx eax, al
|
||||||
|
@ -482,12 +482,12 @@ namespace ttmath
|
||||||
|
|
||||||
p:
|
p:
|
||||||
sub [ebx+edx*4], eax
|
sub [ebx+edx*4], eax
|
||||||
jnc end
|
jnc end
|
||||||
|
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
inc edx
|
inc edx
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz p
|
jnz p
|
||||||
|
|
||||||
end:
|
end:
|
||||||
setc al
|
setc al
|
||||||
|
@ -569,7 +569,7 @@ namespace ttmath
|
||||||
|
|
||||||
inc edx
|
inc edx
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz p
|
jnz p
|
||||||
|
|
||||||
setc dl
|
setc dl
|
||||||
movzx eax, dl
|
movzx eax, dl
|
||||||
|
@ -644,7 +644,7 @@ namespace ttmath
|
||||||
rcr dword ptr [ebx+ecx*4-4], 1
|
rcr dword ptr [ebx+ecx*4-4], 1
|
||||||
|
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz p
|
jnz p
|
||||||
|
|
||||||
setc cl
|
setc cl
|
||||||
movzx eax, cl
|
movzx eax, cl
|
||||||
|
@ -724,7 +724,7 @@ namespace ttmath
|
||||||
or eax, eax
|
or eax, eax
|
||||||
cmovnz esi, [mask] // if c then old value = mask
|
cmovnz esi, [mask] // if c then old value = mask
|
||||||
|
|
||||||
p:
|
p:
|
||||||
rol dword ptr [ebx+edx*4], cl
|
rol dword ptr [ebx+edx*4], cl
|
||||||
|
|
||||||
mov eax, [ebx+edx*4]
|
mov eax, [ebx+edx*4]
|
||||||
|
@ -735,7 +735,7 @@ namespace ttmath
|
||||||
|
|
||||||
inc edx
|
inc edx
|
||||||
dec edi
|
dec edi
|
||||||
jnz p
|
jnz p
|
||||||
|
|
||||||
and eax, 1
|
and eax, 1
|
||||||
}
|
}
|
||||||
|
@ -850,7 +850,7 @@ namespace ttmath
|
||||||
|
|
||||||
dec edx
|
dec edx
|
||||||
dec edi
|
dec edi
|
||||||
jnz p
|
jnz p
|
||||||
|
|
||||||
rol eax, 1 // bit 31 will be bit 0
|
rol eax, 1 // bit 31 will be bit 0
|
||||||
and eax, 1
|
and eax, 1
|
||||||
|
@ -974,14 +974,14 @@ namespace ttmath
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov eax, [v]
|
mov eax, [v]
|
||||||
mov ebx, [bit]
|
mov ebx, [bit]
|
||||||
bts eax, ebx
|
bts eax, ebx
|
||||||
mov [v], eax
|
mov [v], eax
|
||||||
|
|
||||||
setc bl
|
setc bl
|
||||||
movzx ebx, bl
|
movzx ebx, bl
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1034,11 +1034,11 @@ namespace ttmath
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov eax, [a]
|
mov eax, [a]
|
||||||
mul dword ptr [b]
|
mul dword ptr [b]
|
||||||
|
|
||||||
mov [result2_], edx
|
mov [result2_], edx
|
||||||
mov [result1_], eax
|
mov [result1_], eax
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,11 +42,14 @@ adc_x64 PROC
|
||||||
|
|
||||||
jnz loop1
|
jnz loop1
|
||||||
|
|
||||||
setc al
|
jc return_1 ; most of the times, there will be NO carry (I hope)
|
||||||
movzx rax, al
|
xor rax, rax
|
||||||
|
ret
|
||||||
|
|
||||||
|
return_1:
|
||||||
|
mov rax, 1
|
||||||
|
ret
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
adc_x64 ENDP
|
adc_x64 ENDP
|
||||||
|
|
||||||
;----------------------------------------
|
;----------------------------------------
|
||||||
|
@ -73,10 +76,13 @@ loop1:
|
||||||
jnz loop1
|
jnz loop1
|
||||||
|
|
||||||
done:
|
done:
|
||||||
setc al
|
jc return_1 ; most of the times, there will be NO carry (I hope)
|
||||||
movzx rax, al
|
xor rax, rax
|
||||||
|
ret
|
||||||
ret
|
|
||||||
|
return_1:
|
||||||
|
mov rax, 1
|
||||||
|
ret
|
||||||
|
|
||||||
addindexed_x64 ENDP
|
addindexed_x64 ENDP
|
||||||
|
|
||||||
|
@ -110,10 +116,13 @@ loop1:
|
||||||
jnz loop1
|
jnz loop1
|
||||||
|
|
||||||
done:
|
done:
|
||||||
setc al
|
jc return_1 ; most of the times, there will be NO carry (I hope)
|
||||||
movzx rax, al
|
xor rax, rax
|
||||||
|
ret
|
||||||
ret
|
|
||||||
|
return_1:
|
||||||
|
mov rax, 1
|
||||||
|
ret
|
||||||
|
|
||||||
addindexed2_x64 ENDP
|
addindexed2_x64 ENDP
|
||||||
|
|
||||||
|
@ -144,10 +153,13 @@ sbb_x64 PROC
|
||||||
|
|
||||||
jnz loop1
|
jnz loop1
|
||||||
|
|
||||||
setc al
|
jc return_1 ; most of the times, there will be NO carry (I hope)
|
||||||
movzx rax, al
|
xor rax, rax
|
||||||
|
ret
|
||||||
ret
|
|
||||||
|
return_1:
|
||||||
|
mov rax, 1
|
||||||
|
ret
|
||||||
|
|
||||||
sbb_x64 ENDP
|
sbb_x64 ENDP
|
||||||
|
|
||||||
|
@ -174,10 +186,13 @@ loop1:
|
||||||
jnz loop1
|
jnz loop1
|
||||||
|
|
||||||
done:
|
done:
|
||||||
setc al
|
jc return_1 ; most of the times, there will be NO carry (I hope)
|
||||||
movzx rax, al
|
xor rax, rax
|
||||||
|
ret
|
||||||
ret
|
|
||||||
|
return_1:
|
||||||
|
mov rax, 1
|
||||||
|
ret
|
||||||
|
|
||||||
subindexed_x64 ENDP
|
subindexed_x64 ENDP
|
||||||
|
|
||||||
|
@ -270,6 +285,8 @@ rcl2_x64 PROC
|
||||||
; r8 = bits
|
; r8 = bits
|
||||||
; r9 = c
|
; r9 = c
|
||||||
|
|
||||||
|
push rbx
|
||||||
|
|
||||||
mov r10, rcx ; r10 = p1
|
mov r10, rcx ; r10 = p1
|
||||||
xor rax, rax
|
xor rax, rax
|
||||||
|
|
||||||
|
@ -301,6 +318,7 @@ loop1:
|
||||||
jnz loop1
|
jnz loop1
|
||||||
|
|
||||||
and rax, 1
|
and rax, 1
|
||||||
|
pop rbx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
rcl2_x64 ENDP
|
rcl2_x64 ENDP
|
||||||
|
@ -317,6 +335,7 @@ rcr2_x64 PROC
|
||||||
; r8 = bits
|
; r8 = bits
|
||||||
; r9 = c
|
; r9 = c
|
||||||
|
|
||||||
|
push rbx
|
||||||
mov r10, rcx ; r10 = p1
|
mov r10, rcx ; r10 = p1
|
||||||
xor rax, rax
|
xor rax, rax
|
||||||
|
|
||||||
|
@ -350,6 +369,7 @@ loop1:
|
||||||
|
|
||||||
rol rax, 1
|
rol rax, 1
|
||||||
and rax, 1
|
and rax, 1
|
||||||
|
pop rbx
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue