Signed-off-by: Zhao Yi zhaoyi@uniontech.com --- dlls/ntdll/large_int.c | 46 ++++++++++++++++++++++++++++++++++-------- dlls/ntdll/ntdll.spec | 4 ++-- 2 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/large_int.c b/dlls/ntdll/large_int.c index b38074158c8..2f6e27eff10 100644 --- a/dlls/ntdll/large_int.c +++ b/dlls/ntdll/large_int.c @@ -821,10 +821,25 @@ ULONGLONG WINAPI _aulldiv( ULONGLONG a, ULONGLONG b ) * RETURNS * The left-shifted value. */ -LONGLONG WINAPI _allshl( LONGLONG a, LONG b ) -{ - return a << b; -} +__ASM_GLOBAL_FUNC( _allshl, +"cmp $0x40, %cl\n\t" +"jnb 1f\n\t" +"cmp $0x20, %cl\n\t" +"jnb 2f\n\t" +"shld %cl, %eax, %edx\n\t" +"shl %cl, %eax\n\t" +"ret\n\t" +"2:\n\t" +"mov %eax, %edx\n\t" +"xor %eax, %eax\n\t" +"and $0x1f, %cl\n\t" +"shl %cl, %edx\n\t" +"ret\n\t" +"1:\n\t" +"xor %eax, %eax\n\t" +"xor %edx, %edx\n\t" +"ret\n\t" +)
/****************************************************************************** * _allshr (NTDLL.@) @@ -838,10 +853,25 @@ LONGLONG WINAPI _allshl( LONGLONG a, LONG b ) * RETURNS * The right-shifted value. */ -LONGLONG WINAPI _allshr( LONGLONG a, LONG b ) -{ - return a >> b; -} +__ASM_GLOBAL_FUNC( _allshr, +"cmp $0x40, %cl\n\t" +"jnb 1f\n\t" +"cmp $0x20, %cl\n\t" +"jnb 2f\n\t" +"shrd %cl,%edx,%eax\n\t" +"sar %cl,%edx\n\t" +"ret\n\t" +"2:\n\t" +"mov %edx,%eax\n\t" +"sar $0x1f,%edx\n\t" +"and $0x1f,%cl\n\t" +"sar %cl,%eax\n\t" +"ret\n\t" +"1:\n\t" +"sar $0x1f,%edx\n\t" +"mov %edx,%eax\n\t" +"ret\n\t" +)
/****************************************************************************** * _alldvrm (NTDLL.@) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index b1650ab4306..6b96b0433fd 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1492,8 +1492,8 @@ @ cdecl -norelay -arch=i386 -ret64 _allmul(int64 int64) @ cdecl -arch=i386 -norelay _alloca_probe() @ cdecl -norelay -arch=i386 -ret64 _allrem(int64 int64) -@ stdcall -arch=i386 -ret64 _allshl(int64 long) -@ stdcall -arch=i386 -ret64 _allshr(int64 long) +@ cdecl -arch=i386 -ret64 _allshl() +@ cdecl -arch=i386 -ret64 _allshr() @ cdecl -ret64 _atoi64(str) @ cdecl -norelay -arch=i386 -ret64 _aulldiv(int64 int64) @ cdecl -arch=i386 -norelay _aulldvrm(int64 int64)