MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / fast_pow

Method fast_pow

343. Integer Break/Solution.cpp:29–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 }
28
29 int fast_pow(int x, int y) {
30 int res = 1;
31 for (int offset = sizeof(int) * 8 - 1; offset >= 0; offset --) {
32 res *= res;
33 if (y & (1 << offset)) res *= x;
34 }
35 return res;
36 }
37
38};
39

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected