ntdll: Reimplement _alldiv using 32-bit arithmetic.
Based on compiler-rt. Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
744843ed01
commit
8f144eb566
|
@ -736,7 +736,12 @@ static ULONGLONG udivmod(ULONGLONG a, ULONGLONG b, ULONGLONG *rem)
|
|||
*/
|
||||
LONGLONG WINAPI _alldiv( LONGLONG a, LONGLONG b )
|
||||
{
|
||||
return a / b;
|
||||
LONGLONG s_a = a >> 63; /* s_a = a < 0 ? -1 : 0 */
|
||||
LONGLONG s_b = b >> 63; /* s_b = b < 0 ? -1 : 0 */
|
||||
a = (a ^ s_a) - s_a; /* negate if s_a == -1 */
|
||||
b = (b ^ s_b) - s_b; /* negate if s_b == -1 */
|
||||
s_a ^= s_b; /* sign of quotient */
|
||||
return (udivmod(a, b, NULL) ^ s_a) - s_a; /* negate if s_a == -1 */
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue