|
|
1.1 ! root 1: /* ! 2: * "@(#)bit.c 1.1" ! 3: * ! 4: * bit set, clear, test routines ! 5: * ! 6: * calling sequences: ! 7: * logical l, bit, state ! 8: * call bis (bitnum, word) ! 9: * call bic (bitnum, word) ! 10: * call setbit (bitnum, word, state) ! 11: * l = bit (bitnum, word) ! 12: * where: ! 13: * bis(bic) sets(clears) bitnum in word ! 14: * setbit sets bitnum in word to 1 if state is .true. ! 15: * bit tests bitnum in word and returns a logical (t/f) value ! 16: */ ! 17: ! 18: long bis_(n, w) ! 19: long *n, *w; ! 20: { ! 21: /* No parameter check needed; SHLL results 0 when n is out of range, */ ! 22: /* and w|0 == w. */ ! 23: /* if (*n >= 0 && *n <= 31) */ ! 24: ! 25: *w |= (1L << (*n)); ! 26: } ! 27: ! 28: long bic_(n, w) ! 29: long *n, *w; ! 30: { ! 31: /* No parameter check needed; SHLL results 0 when n is out of range, */ ! 32: /* and w|~0 == w. */ ! 33: /* if (*n >= 0 && *n <= 31) */ ! 34: ! 35: *w &= ~(1L << (*n)); ! 36: } ! 37: ! 38: long bit_(n, w) ! 39: long *n, *w; ! 40: { ! 41: /* ! 42: if (*n < 0 || *n > 31) ! 43: return(0); ! 44: return((*w & (1L << (*n))) != 0); ! 45: */ ! 46: asm(" clrl r0"); ! 47: asm(" tstl *4(fp)"); ! 48: asm(" jlss out"); ! 49: asm(" cmpl *4(fp),$31"); ! 50: asm(" jgtr out"); ! 51: asm(" jbc *4(fp),*8(fp),out"); ! 52: asm(" movl $1,r0"); ! 53: asm("out: ret"); ! 54: } ! 55: ! 56: setbit_(n, w, s) ! 57: long *n, *w, *s; ! 58: { ! 59: if (*s) ! 60: /* Skip the call */ ! 61: /* bis_(n, w); */ ! 62: ! 63: *w |= (1L << (*n)); ! 64: else ! 65: /* Skip the call */ ! 66: /* bic_(n, w); */ ! 67: ! 68: *w &= ~(1L << (*n)); ! 69: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.