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

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

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

revision 1.5 by joerg_wunsch, Tue Sep 13 13:29:54 2005 UTC revision 1.6 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     strcasecmp.S     strcasecmp.S
33     Case insensitive compare     Case insensitive compare
# Line 59  Line 61 
61    
62  #if !defined(__DOXYGEN__)  #if !defined(__DOXYGEN__)
63    
64      .text          .text
65      .global _U(strcasecmp)          .global _U(strcasecmp)
66      .type   _U(strcasecmp), @function          .type   _U(strcasecmp), @function
67            
68  _U(strcasecmp):  _U(strcasecmp):
69      LOAD_Z(s2_lo, s2_hi)          X_movw  ZL, s2_lo
70      LOAD_X(s1_lo, s1_hi)          X_movw  XL, s1_lo
71  .strcasecmp_loop:  .L_strcasecmp_loop:
72      LD    ret_lo, X+          ; load *s1          LD      ret_lo, X+              ; load *s1
73      LD    tmp, Z+             ; load *s2          LD      tmp, Z+                 ; load *s2
74      MOV   cht, tmp            ; copy of *s2 to tmp          MOV     cht, tmp                ; copy of *s2 to tmp
75      ORI   cht, 0x20           ; make tmp lower case          ORI     cht, 0x20               ; make tmp lower case
76      CPI   cht, 'a'            ; test on [a .. z]          CPI     cht, 'a'                ; test on [a .. z]
77          BRLT  .strcasecmp_tst          BRLT    .L_strcasecmp_tst
78      CPI   cht, 'z'+1          CPI     cht, 'z'+1
79          BRGE  .strcasecmp_tst          BRGE    .L_strcasecmp_tst
80      ORI   tmp, 0x20           ; we got an aplpha in s2          ORI     tmp, 0x20               ; we got an aplpha in s2
81      ORI   ret_lo, 0x20          ORI     ret_lo, 0x20
82  .strcasecmp_tst:                 ; compare  .L_strcasecmp_tst:                      ; compare
83      SUB   ret_lo, tmp          SUB     ret_lo, tmp
84      BRNE  .strcasecmp_done          BRNE    .L_strcasecmp_done
85      TST   tmp                 ; end of s2?          TST     tmp                     ; end of s2?
86      BRNE  .strcasecmp_loop          BRNE    .L_strcasecmp_loop
87  .strcasecmp_done:  .L_strcasecmp_done:
88  ; ret_hi = SREG.C ? 0xFF : 0  ; ret_hi = SREG.C ? 0xFF : 0
89      SBC   ret_hi, ret_hi          SBC     ret_hi, ret_hi
90      RET          RET
91  .strcasecmp_end:  .L_strcasecmp_end:
92      .size   _U(strcasecmp), .strcasecmp_end - _U(strcasecmp)          .size   _U(strcasecmp), .L_strcasecmp_end - _U(strcasecmp)
93    
94  #endif /* not __DOXYGEN__ */  #endif /* not __DOXYGEN__ */

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

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