1: /* ffc.c 1.4 83/05/13 */
2:
3: /*
4: * If used on a vax (i.e., VAX is defined), this routine simply executes
5: * the VAX find-first-set instruction.
6: * Usage:
7: * int startbit, field_lth, field, result;
8: * result = ffc(startbit,field_lth,field);
9: *
10: * startbit is the bit number of the field to start the search,
11: * the rightmost bit is number one.
12: * field_lth is the length of the field in bits.
13: * field is the actual field
14: * result is the resulting bit number,
15: * e.g. the number of the first clear bit in the field.
16: * hs 10/29/82
17: */
18:
19: ffc(start, len, field)
20:
21: #ifndef VAX
22: register long field;
23: int start, len;
24: {
25: register int i;
26:
27: for (i=start; i<len; i++) {
28: if ((field&1) == 0)
29: break;
30: field >>= 1;
31: }
32: return (i);
33: }
34: #else
35:
36: int start, len, field;
37: {
38: asm("ffc 4(ap),8(ap),12(ap),r0");
39: return;
40: }
41: #endif
Defined functions
ffc
defined in line
19; used 1 times
Defined variables
field
defined in line
36; used 4 times
len
defined in line
36; used 3 times
start
defined in line
36; used 3 times