* lib/objc.exp: Add -lposix4 on Solaris 2.8.
[official-gcc.git] / libf2c / libF77 / pow_ii.c
blob84d1c7e0b5ec06095c588cb09033330f1b3261af
1 #include "f2c.h"
3 #ifdef KR_headers
4 integer pow_ii(ap, bp) integer *ap, *bp;
5 #else
6 integer pow_ii(integer *ap, integer *bp)
7 #endif
9 integer pow, x, n;
10 unsigned long u;
12 x = *ap;
13 n = *bp;
15 if (n <= 0) {
16 if (n == 0 || x == 1)
17 return 1;
18 if (x != -1)
19 return x == 0 ? 1/x : 0;
20 n = -n;
22 u = n;
23 for(pow = 1; ; )
25 if(u & 01)
26 pow *= x;
27 if(u >>= 1)
28 x *= x;
29 else
30 break;
32 return(pow);