/* This C language subroutine compares two strings with a limit on the length. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 4/30/90 Updated on 6/94 by AS Updated on 3/95 by AS - separated polymorphic functions #include
int strncmp(const char *s1, const char *s2, size_t size); */ #include "lib_glob.h" #include "str_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ___strncmpDP; ___strncmpDP: ncompare_core: R12=PASS R12, dm_ptr=R4; /*Test for 0 count, Point to s1*/ IF LE JUMP (PC, restore_state) (DB); R0=R0-R0, pm_ptr=R8; /*Point to s2*/ R12=R12-1, R2=DM(dm_ptr,1); /*Read *s1*/ dm_to_pm_ncompare: IF EQ JUMP (PC, dm_pm_finish); LCNTR=R12, DO dm_pm UNTIL LCE; R2=PASS R2, R0=PM(pm_ptr,1); /*Read *s2*/ IF EQ JUMP (PC, restore_state) (LA); R0=R2-R0, R2=DM(dm_ptr,1); dm_pm: IF NE JUMP (PC, restore_state) (LA); dm_pm_finish: R0=PM(pm_ptr,1); /*Read last sample*/ R0=R2-R0; /*outside of loop*/ restore_state: FETCH_RETURN RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;