MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / Pow2

Method Pow2

extern/ttmath/ttmathint.h:576–593  ·  view source on GitHub ↗

! power this = this ^ pow this can be negative pow is >= 0 */

Source from the content-addressed store, hash-verified

574 pow is >= 0
575 */
576 uint Pow2(const Int<value_size> & pow)
577 {
578 bool was_sign = IsSign();
579 uint c = 0;
580
581 if( was_sign )
582 c += Abs();
583
584 uint c_temp = UInt<value_size>::Pow(pow);
585 if( c_temp > 0 )
586 return c_temp; // c_temp can be: 0, 1 or 2
587
588 if( was_sign && (pow.table[0] & 1) == 1 )
589 // negative value to the power of odd number is negative
590 c += ChangeSign();
591
592 return (c==0)? 0 : 1;
593 }
594
595
596public:

Callers 1

PowMethod · 0.80

Calls 1

AbsFunction · 0.85

Tested by

no test coverage detected