# Copyright (c) 1979 Regents of the University of California
# char sccsid[] = "@(#)05index.s 4.1 10/10/80";
cvtwl (r10)+,r0 #r0 has size
clrl r3 #r3 has base subscript
blss esubscr #check lower bound
cmpw r3,(r10)+ #check upper bound
mull2 r0,r3 #calc byte offset
addl2 r3,(sp) #calculate actual address
cvtwl (r10)+,r0 #r0 has size
cvtwl (r10)+,r1 #r1 has lower bound
movzwl (r10)+,r2 #r2 has upper-lower bound
subl3 r1,(sp)+,r3 #r3 has base subscript
cmpl r3,r2 #check for out of bounds
mull2 r0,r3 #calc byte offset
addl2 r3,(sp) #calculate actual address
cvtbl (r10)+,r0 #r0 has shift amount
cvtwl (r10)+,r2 #r2 has lower bound
subl3 r2,(sp)+,r1 #r1 has base subscript
cvtbl (r10)+,r0 #r0 has shift amount
cvtwl (r10)+,r1 #r1 has base array value
cvtwl (sp)+,r2 #r2 has subscript value
subl2 r1,r2 #r2 has element offset
ashl r0,r2,r2 #r2 has byte offset