long _modslong (long a, long b) { if (a < 0) { if (b < 0) return _modulong ((unsigned long)-a, (unsigned long)-b); else return _modulong ((unsigned long)-a, (unsigned long)b); } else { if (b < 0) return _modulong ((unsigned long)a, (unsigned long)-b); else return _modulong ((unsigned long)a, (unsigned long)b); } /* we never reach here */ }
long _modslong (long a, long b) { long r; r = _modulong((a < 0 ? -a : a), (b < 0 ? -b : b)); if (a < 0) return -r; else return r; }