@@ -803,6 +803,9 @@ bool mpz_is_zero(const mpz_t *z) {
803803 return z -> len == 0 ;
804804}
805805
806+ #if 0
807+ these functions are unused
808+
806809bool mpz_is_pos (const mpz_t * z ) {
807810 return z -> len > 0 && z -> neg == 0 ;
808811}
@@ -818,6 +821,7 @@ bool mpz_is_odd(const mpz_t *z) {
818821bool mpz_is_even (const mpz_t * z ) {
819822 return z -> len == 0 || (z -> dig [0 ] & 1 ) == 0 ;
820823}
824+ #endif
821825
822826int mpz_cmp (const mpz_t * z1 , const mpz_t * z2 ) {
823827 // to catch comparison of -0 with +0
@@ -921,6 +925,17 @@ mpz_t *mpz_pow(const mpz_t *lhs, const mpz_t *rhs) {
921925 mpz_pow_inpl (z , lhs , rhs );
922926 return z ;
923927}
928+
929+ /* computes new integers in quo and rem such that:
930+ quo * rhs + rem = lhs
931+ 0 <= rem < rhs
932+ can have lhs, rhs the same
933+ */
934+ void mpz_divmod (const mpz_t * lhs , const mpz_t * rhs , mpz_t * * quo , mpz_t * * rem ) {
935+ * quo = mpz_zero ();
936+ * rem = mpz_zero ();
937+ mpz_divmod_inpl (* quo , * rem , lhs , rhs );
938+ }
924939#endif
925940
926941/* computes dest = abs(z)
@@ -1205,7 +1220,7 @@ void mpz_pow_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs) {
12051220 mpz_set_from_int (dest , 1 );
12061221
12071222 while (n -> len > 0 ) {
1208- if (mpz_is_odd ( n ) ) {
1223+ if (( n -> dig [ 0 ] & 1 ) != 0 ) {
12091224 mpz_mul_inpl (dest , dest , x );
12101225 }
12111226 n -> len = mpn_shr (n -> dig , n -> dig , n -> len , 1 );
@@ -1219,6 +1234,9 @@ void mpz_pow_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs) {
12191234 mpz_free (n );
12201235}
12211236
1237+ #if 0
1238+ these functions are unused
1239+
12221240/* computes gcd(z1, z2)
12231241 based on Knuth's modified gcd algorithm (I think?)
12241242 gcd(z1, z2) >= 0
@@ -1294,17 +1312,7 @@ mpz_t *mpz_lcm(const mpz_t *z1, const mpz_t *z2) {
12941312 rem -> neg = 0 ;
12951313 return rem ;
12961314}
1297-
1298- /* computes new integers in quo and rem such that:
1299- quo * rhs + rem = lhs
1300- 0 <= rem < rhs
1301- can have lhs, rhs the same
1302- */
1303- void mpz_divmod (const mpz_t * lhs , const mpz_t * rhs , mpz_t * * quo , mpz_t * * rem ) {
1304- * quo = mpz_zero ();
1305- * rem = mpz_zero ();
1306- mpz_divmod_inpl (* quo , * rem , lhs , rhs );
1307- }
1315+ #endif
13081316
13091317/* computes new integers in quo and rem such that:
13101318 quo * rhs + rem = lhs
0 commit comments