Created
July 24, 2018 01:29
-
-
Save catid/6fa5ed33b42c793ab4ccb1cd9804ec99 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
q = x >> 32 | |
r = x - (q << 32) | |
i = 0 | |
while (q > 0) { | |
t = (q << 4) - q | |
q = t >> 32 | |
r_i = t - (q << 32) | |
if (++i % 2 == 1) | |
r -= r_i | |
else | |
r += r_i | |
} | |
while (r >= m) { | |
r = r - m | |
} | |
return r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment