MCPcopy Create free account
hub / github.com/Gecode/gecode / tpow

Method tpow

gecode/int/arithmetic/pow-ops.hpp:74–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72 }
73
74 inline int
75 PowOps::tpow(int _x) const {
76 int m = n;
77 long long int p = 1;
78 long long int x = _x;
79 do {
80 if (even(m)) {
81 x *= x; m >>= 1;
82 } else {
83 p *= x; m--;
84 }
85 if (p > Limits::max)
86 return Limits::max+1;
87 if (p < Limits::min)
88 return Limits::min-1;
89 } while (m > 0);
90 return static_cast<int>(p);
91 }
92
93 forceinline bool
94 PowOps::powgr(long long int r, int x) const {

Callers 4

minMethod · 0.80
maxMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected