|
|
Power 6/32 Unix version 1.21
/*
* "@(#)bit.c 1.1"
*
* bit set, clear, test routines
*
* calling sequences:
* logical l, bit, state
* call bis (bitnum, word)
* call bic (bitnum, word)
* call setbit (bitnum, word, state)
* l = bit (bitnum, word)
* where:
* bis(bic) sets(clears) bitnum in word
* setbit sets bitnum in word to 1 if state is .true.
* bit tests bitnum in word and returns a logical (t/f) value
*/
long bis_(n, w)
long *n, *w;
{
/* No parameter check needed; SHLL results 0 when n is out of range, */
/* and w|0 == w. */
/* if (*n >= 0 && *n <= 31) */
*w |= (1L << (*n));
}
long bic_(n, w)
long *n, *w;
{
/* No parameter check needed; SHLL results 0 when n is out of range, */
/* and w|~0 == w. */
/* if (*n >= 0 && *n <= 31) */
*w &= ~(1L << (*n));
}
long bit_(n, w)
long *n, *w;
{
/*
if (*n < 0 || *n > 31)
return(0);
return((*w & (1L << (*n))) != 0);
*/
asm(" clrl r0");
asm(" tstl *4(fp)");
asm(" jlss out");
asm(" cmpl *4(fp),$31");
asm(" jgtr out");
asm(" jbc *4(fp),*8(fp),out");
asm(" movl $1,r0");
asm("out: ret");
}
setbit_(n, w, s)
long *n, *w, *s;
{
if (*s)
/* Skip the call */
/* bis_(n, w); */
*w |= (1L << (*n));
else
/* Skip the call */
/* bic_(n, w); */
*w &= ~(1L << (*n));
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.