Changeset 9899df in git for factory/gmpext.h
- Timestamp:
- Nov 11, 2010, 5:26:41 PM (13 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 8b2ef529c04c7b3517f5001ff6c69e582bb9fd09
- Parents:
- c73520d5d0c7a156ce1ef3256417b5157e57cc61
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/gmpext.h
rc73520d r9899df 20 20 } 21 21 22 inline void23 mpz_mypow_ui( MP_INT * result, int p, int n )24 {25 if ( p == 0 )26 mpz_set_ui( result, 0 );27 else if ( n == 0 )28 mpz_set_ui( result, 1 );29 else {30 mpz_set_ui( result, p );31 n--;32 while ( n > 0 ) {33 mpz_mul_ui( result, result, p );34 n--;35 }36 }37 }38 39 inline void40 mpz_mypow( MP_INT * result, MP_INT * p, int n )41 {42 // p == 0 && n == 0 should not happen since this function is only used43 // in the factorizing algorithm44 mpz_set( result, p );45 n--;46 while ( n > 0 ) {47 mpz_mul( result, result, p );48 n--;49 }50 }51 52 22 #endif /* ! INCL_GMPEXT_H */
Note: See TracChangeset
for help on using the changeset viewer.