/* 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 ___strncmpPD; ___strncmpPD: ncompare_core: R12=PASS R12, dm_ptr=R8; /*Test for 0 count, Point to s2*/ IF LE JUMP (PC, restore_state) (DB); R0=R0-R0, pm_ptr=R4; /*Point to s1 */ R12=R12-1, R2=PM(pm_ptr,1); /*Read *s1 */ pm_to_dm_ncompare: IF EQ JUMP (PC, pm_dm_finish); /*Only one compare */ LCNTR=R12, DO pm_dm UNTIL LCE; R2=PASS R2, R0=DM(dm_ptr,1); /*Read *s2 */ IF EQ JUMP (PC, restore_state) (LA); R0=R2-R0, R2=PM(pm_ptr,1); pm_dm: IF NE JUMP (PC, restore_state) (LA); pm_dm_finish: R0=DM(dm_ptr,1); /*Read last sample */ R0=R2-R0; /* outside of loop */ restore_state: FETCH_RETURN RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;