incl r0 #r0 has number of bytes in set
addl3 sp,r0,r1 #r1 has pointer to second set
ashl $-1,r0,r0 #r0 has number of words in set
incl r0 #r0 has number of bytes in set
addl3 sp,r0,r1 #r1 has pointer to second set
ashl $-1,r0,r0 #r0 has number of words in set
incl r0 #r0 has number of bytes in set
addl3 sp,r0,r1 #r1 has pointer to second set
ashl $-1,r0,r0 #r0 has number of words in set
cvtbl (r10)+,r0 #r0 has number of bytes in set
addl3 r0,sp,r4 #r4 has new stack addr
ashl $3,r0,r0 #r0 has number of bits in set
mnegl $1,r1 #will init r1 to zero
mnegl $1,r5 #will init r2 to zero
incl r1 #count found element
incl r5 #advance to next field position
ffs r5,$32,(sp),r5 #find next set bit
beql l2521 #nothing found, so continue
cmpl r5,r0 #check for end of field
blss l2512 #element found, so count and continue
movw r1,-(sp) #put answer on stack
cvtwl (r10)+,r0 #r0 has size of set
cvtwl (sp)+,r1 #r1 has set index
addl3 r0,sp,r4 #r4 points to new top of stack
subw2 (r10)+,r1 #check below lower
cmpw r1,(r10)+ #check above upper
bbc r1,(sp),l2517 #check for bit set
movl r4,sp #bit not found
cvtwl (sp)+,r0 #r0 has value to find
cvtwl (sp)+,r1 #r1 has pair count
moval (sp)[r1],sp #clear off remaining data on stack