/[avr-libc]/avr-libc/libc/string/strncasecmp.S
ViewVC logotype

Diff of /avr-libc/libc/string/strncasecmp.S

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by joerg_wunsch, Tue Sep 13 13:29:54 2005 UTC revision 1.5 by aesok, Sat Nov 5 16:49:46 2005 UTC
# Line 26  Line 26 
26    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27    POSSIBILITY OF SUCH DAMAGE. */    POSSIBILITY OF SUCH DAMAGE. */
28    
29    /* $Id$ */
30    
31  /*  /*
32     strncasecmp.S     strncasecmp.S
33     Case insensitive compare     Case insensitive compare
# Line 60  Line 62 
62    
63  #if !defined(__DOXYGEN__)  #if !defined(__DOXYGEN__)
64    
65      .text          .text
66      .global _U(strncasecmp)          .global _U(strncasecmp)
67      .type   _U(strncasecmp), @function          .type   _U(strncasecmp), @function
68            
69  _U(strncasecmp):  _U(strncasecmp):
70      LOAD_Z(s2_lo, s2_hi)          X_movw  ZL, s2_lo
71      LOAD_X(s1_lo, s1_hi)          X_movw  XL, s1_lo
72  .strncasecmp_loop:  .L_strncasecmp_loop:
73      SUBI    len_lo, lo8(1)          SUBI    len_lo, lo8(1)
74      SBCI    len_hi, hi8(1)          SBCI    len_hi, hi8(1)
75      BRCS    .strncasecmp_equal          BRCS    .L_strncasecmp_equal
76      LD      ret_lo, X+          ; load *s1          LD      ret_lo, X+              ; load *s1
77      LD      tmp, Z+             ; load *s2          LD      tmp, Z+                 ; load *s2
78      MOV     cht, tmp            ; copy of *s2 to cht          MOV     cht, tmp                ; copy of *s2 to cht
79      ORI     cht, 0x20           ; make it lower case          ORI     cht, 0x20               ; make it lower case
80      CPI     cht, 'a'            ; test on [a .. z]          CPI     cht, 'a'                ; test on [a .. z]
81      BRLT    .strncasecmp_tst          BRLT    .L_strncasecmp_tst
82      CPI     cht, 'z'+1          CPI     cht, 'z'+1
83      BRGE    .strncasecmp_tst          BRGE    .L_strncasecmp_tst
84      ORI     tmp, 0x20           ; we got an alpha in s2          ORI     tmp, 0x20               ; we got an alpha in s2
85      ORI     ret_lo, 0x20        ; make *s1, *s2 lower case          ORI     ret_lo, 0x20            ; make *s1, *s2 lower case
86  .strncasecmp_tst:  .L_strncasecmp_tst:
87      SUB     ret_lo, tmp         ; compare chars          SUB     ret_lo, tmp             ; compare chars
88      BRNE    .strncasecmp_done          BRNE    .L_strncasecmp_done
89      TST     tmp                 ; end of s2?          TST     tmp                     ; end of s2?
90      BRNE    .strncasecmp_loop          BRNE    .L_strncasecmp_loop
91  .strncasecmp_equal:  .L_strncasecmp_equal:
92      SUB     ret_lo, ret_lo      ; clear ret_lo and C flag          SUB     ret_lo, ret_lo          ; clear ret_lo and C flag
93  .strncasecmp_done:  .L_strncasecmp_done:
94  ; ret_hi = SREG.C ? 0xFF : 0  ; ret_hi = SREG.C ? 0xFF : 0
95      SBC     ret_hi, ret_hi          SBC     ret_hi, ret_hi
96      RET          RET
97  .strncasecmp_end:  .L_strncasecmp_end:
98      .size   _U(strncasecmp), .strncasecmp_end - _U(strncasecmp)          .size   _U(strncasecmp), .L_strncasecmp_end - _U(strncasecmp)
99    
100  #endif /* not __DOXYGEN__ */  #endif /* not __DOXYGEN__ */

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26