Write a function integerPower(base, exponent) that returns the value of baseexponent

a
Last edited on
Hello gokhanyildirim99,

If you are still wondering the answer is 42.

https://www.youtube.com/watch?v=aboZctrHfK8
https://www.dictionary.com/e/slang/42/

Andy
ooo, I havent had a chance to post this monster in a while!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
inline long long ipow(long long p, unsigned long long e) 
{ 
  const long long one = 1;
  const long long *lut[2] = {&p,&one};
  register long long result = 1;
    result *= lut[!(e&1)][0]; p *= p;
	result *= lut[!(e&2)][0]; p *= p;
	result *= lut[!(e&4)][0]; p *= p;
	result *= lut[!(e&8)][0]; p *= p;
	result *= lut[!(e&16)][0]; p *= p;
	result *= lut[!(e&32)][0]; p *= p;
	result *= lut[!(e&64)][0]; 	
	return result;
}
Topic archived. No new replies allowed.