Created
November 4, 2019 11:43
-
-
Save simon-engledew/573538fa040b9d560804a0eb0dfa31fd to your computer and use it in GitHub Desktop.
knuth intpow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned int intpow(unsigned int a, unsigned int b) | |
{ | |
unsigned int p = 1; | |
for (; b > 0;) | |
{ | |
if ((b & 1) != 0) | |
{ | |
p *= a; | |
} | |
b >>= 1; | |
a *= a; | |
} | |
return p; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment