1*47942Sbostic/*- 2*47942Sbostic * Copyright (c) 1991 The Regents of the University of California. 3*47942Sbostic * All rights reserved. 4*47942Sbostic * 5*47942Sbostic * This code is derived from software contributed to Berkeley by 6*47942Sbostic * Computer Consoles Inc. 7*47942Sbostic * 8*47942Sbostic * %sccs.include.proprietary.c% 9*47942Sbostic */ 1029958Smckusick 11*47942Sbostic#ifndef lint 12*47942Sbostic .asciz "@(#)h_indx_s.s 5.2 (Berkeley) 04/12/91" 13*47942Sbostic#endif /* not lint */ 14*47942Sbostic 1529958Smckusick.data 1629958Smckusick.text 1729958SmckusickLL0:.align 1 1829958Smckusick.globl _h_indx 1929958Smckusick.set MASK__, 0x1c0c 2029958Smckusick.data 2129958Smckusick.text 2229958Smckusick_h_indx: .word MASK__ 2329958Smckusick 2429958Smckusick movl 4(fp), r3 /* s = a */ 2529958Smckusick movl 8(fp), r10 /* b */ 2629958Smckusick movl 16(fp), r12 /* lb */ 2729958Smckusick addl3 r3, 12(fp), r11 /* end = a + la */ 2829958Smckusick subl2 r12, r11 /* end -= lb */ 2929958Smckusickloop: 3029958Smckusick cmpl r3, r11 /* while (s <= end) */ 3129958Smckusick jgtr out0 /* not found - return(0) */ 3229958Smckusick movl r3, r0 /* current s in string */ 3329958Smckusick movl r10, r1 /* b */ 3429958Smckusick movl r12, r2 /* lb */ 3529958Smckusick cmps3 /* if strings equal */ 3629958Smckusick jeql out /* return index */ 3729958Smckusick 3829958Smckusick incl r3 /* s++ */ 3929958Smckusick jbr loop 4029958Smckusick 4129958Smckusickout: 4229958Smckusick incl r3 /* index = ++s - a */ 4329958Smckusick subl3 4(fp), r3, r0 4429958Smckusick ret 4529958Smckusick 4629958Smckusickout0: 4729958Smckusick clrl r0 4829958Smckusick ret 49