ntdll: Reimplement _allrem 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
8f144eb566
commit
0547da64a3
|
@ -777,7 +777,13 @@ LONGLONG WINAPI _allmul( LONGLONG a, LONGLONG b )
|
|||
*/
|
||||
LONGLONG WINAPI _allrem( LONGLONG a, LONGLONG b )
|
||||
{
|
||||
return a % b;
|
||||
LONGLONG s = b >> 63; /* s = b < 0 ? -1 : 0 */
|
||||
ULONGLONG r;
|
||||
b = (b ^ s) - s; /* negate if s == -1 */
|
||||
s = a >> 63; /* s = a < 0 ? -1 : 0 */
|
||||
a = (a ^ s) - s; /* negate if s == -1 */
|
||||
udivmod(a, b, &r);
|
||||
return ((LONGLONG)r ^ s) - s; /* negate if s == -1 */
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue