home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / libF77 / pow_hh.c < prev    next >
Encoding:
Text File  |  1979-01-10  |  218 b   |  24 lines

  1. short pow_hh(ap, bp)
  2. short *ap, *bp;
  3. {
  4. short pow, x, n;
  5.  
  6. pow = 1;
  7. x = *ap;
  8. n = *bp;
  9.  
  10. if(n < 0)
  11.     { }
  12. else if(n > 0)
  13.     for( ; ; )
  14.         {
  15.         if(n & 01)
  16.             pow *= x;
  17.         if(n >>= 1)
  18.             x *= x;
  19.         else
  20.             break;
  21.         }
  22. return(pow);
  23. }
  24.