Skip to content

Instantly share code, notes, and snippets.

@danlark1
Created June 14, 2020 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danlark1/12fd52c74e131f90d708868ee5092562 to your computer and use it in GitHub Desktop.
Save danlark1/12fd52c74e131f90d708868ee5092562 to your computer and use it in GitHub Desktop.
struct GmpDiv {
uint64_t operator()(uint64_t u1, uint64_t u0, uint64_t v, du_int* r) const {
mp_limb_t q[2] = {u0, u1};
mp_limb_t result[2] = {0, 0};
*r = mpn_divrem_1(result, 0, q, 2, v);
return result[0];
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment