Open Source Computer Vision Library https://opencv.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

25 lines
406 B

#include "f2c.h"
int pow_ii(int *ap, int *bp)
{
int p;
int x = *ap;
int n = *bp;
if (n <= 0) {
if (n == 0 || x == 1)
return 1;
return x != -1 ? 0 : (n & 1) ? -1 : 1;
}
unsigned u = (unsigned)n;
for(p = 1; ; )
{
if(u & 01)
p *= x;
if(u >>= 1)
x *= x;
else
break;
}
return p;
}