Commit 0547da64 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Reimplement _allrem using 32-bit arithmetic.

Based on compiler-rt. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8f144eb5
......@@ -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 */
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment