Fix getKaryExpo()

This commit is contained in:
Andreas Fabri 2021-10-07 18:26:17 +01:00
parent f5367709ad
commit b801aaa8fe
1 changed files with 11 additions and 2 deletions

View File

@ -497,8 +497,17 @@ inline unsigned long getBinExpo(const BigInt& z) {
}
/// get exponent of power k
inline void getKaryExpo(const BigInt& z, BigInt& m, int& e, unsigned long k) {
assert(false); // AF: todo
inline void getKaryExpo(const BigInt& z, BigInt& m, int& e, unsigned long uk) {
BigInt k(uk), q, r;
e = 0;
m = z;
for(;;) {
divide_qr(m.get_mp(), k.get_mp(), q.get_mp(), r.get_mp());
if (!r.get_mp().is_zero()) break;
m.get_mp() = q.get_mp();
++e;
}
/*
mpz_t f;
mpz_init_set_ui(f, k);