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