! power this = this ^ pow return values: 0 - ok 1 - carry 2 - incorrect arguments 0^0 or 0^(-something) */
| 605 | 2 - incorrect arguments 0^0 or 0^(-something) |
| 606 | */ |
| 607 | uint Pow(Int<value_size> pow) |
| 608 | { |
| 609 | if( !pow.IsSign() ) |
| 610 | return Pow2(pow); |
| 611 | |
| 612 | if( UInt<value_size>::IsZero() ) |
| 613 | // if 'pow' is negative then |
| 614 | // 'this' must be different from zero |
| 615 | return 2; |
| 616 | |
| 617 | if( pow.ChangeSign() ) |
| 618 | return 1; |
| 619 | |
| 620 | Int<value_size> t(*this); |
| 621 | uint c_temp = t.Pow2(pow); |
| 622 | if( c_temp > 0 ) |
| 623 | return c_temp; |
| 624 | |
| 625 | UInt<value_size>::SetOne(); |
| 626 | if( Div(t) ) |
| 627 | return 1; |
| 628 | |
| 629 | return 0; |
| 630 | } |
| 631 | |
| 632 | |
| 633 |
no test coverage detected