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

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

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

revision 1.4 by troth, Tue Sep 30 23:05:19 2003 UTC revision 1.4.4.1 by aesok, Wed Oct 26 20:53:54 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  #include "macros.inc"  #include "macros.inc"
32    
33  #define src_hi r25  #define src_hi r25
# Line 55  Line 57 
57          .global _U(strrchr)          .global _U(strrchr)
58          .type   _U(strrchr), @function          .type   _U(strrchr), @function
59  _U(strrchr):  _U(strrchr):
60          LOAD_Z(src_lo, src_hi)          X_movw  ZL, src_lo
61          ldi     ret_lo, lo8(1)  ; NULL + 1          ldi     ret_lo, lo8(1)  ; NULL + 1
62          ldi     ret_hi, hi8(1)          ldi     ret_hi, hi8(1)
63  .strrchr_loop:  .L_strrchr_loop:
64          ld      __tmp_reg__, Z+          ld      __tmp_reg__, Z+
65          cp      __tmp_reg__, val_lo          cp      __tmp_reg__, val_lo
66          brne    .strrchr_noteq          brne    .L_strrchr_noteq
67          mov     ret_lo, ZL      ; XXX use movw if available          X_movw  ret_lo, ZL      ; remember this character was here
68          mov     ret_hi, ZH      ; remember this character was here  .L_strrchr_noteq:
 .strrchr_noteq:  
69          tst     __tmp_reg__          tst     __tmp_reg__
70          brne    .strrchr_loop          brne    .L_strrchr_loop
71          sbiw    ret_lo, 1       ; undo post-increment          sbiw    ret_lo, 1       ; undo post-increment
72          ret          ret
73  .strrchr_end:  .L_strrchr_end:
74          .size   _U(strrchr), .strrchr_end - _U(strrchr)          .size   _U(strrchr), .L_strrchr_end - _U(strrchr)
75    
76  #endif /* not DOXYGEN */  #endif /* not DOXYGEN */

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

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