All pastes #805142 Raw Edit

Miscellany

public cpp v1 · immutable
·published 2007-12-04 02:29 UTC
rendered paste body
static inline uint64_t PRE2_MULMOD64(uint64_t a, uint64_t b, uint64_t p){  int64_t tmp, ret;  register double x;  x = (int64_t)a;  tmp = (int64_t)p * (int64_t)(x*b_over_p);  ret = a*b - tmp;  if (ret < 0)    ret += p;  else if (ret >= p)    ret -= p;  return ret;}