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 s1_hi r25 |
#define s1_hi r25 |
56 |
.global _U(strncmp_P) |
.global _U(strncmp_P) |
57 |
.type _U(strncmp_P), @function |
.type _U(strncmp_P), @function |
58 |
_U(strncmp_P): |
_U(strncmp_P): |
59 |
LOAD_Z(s2_lo, s2_hi) |
X_movw ZL, s2_lo |
60 |
LOAD_X(s1_lo, s1_hi) |
X_movw XL, s1_lo |
61 |
.strncmp_P_loop: |
.L_strncmp_P_loop: |
62 |
subi len_lo, lo8(1) |
subi len_lo, lo8(1) |
63 |
sbci len_hi, hi8(1) |
sbci len_hi, hi8(1) |
64 |
brcs .strncmp_P_equal |
brcs .L_strncmp_P_equal |
65 |
ld ret_lo, X+ |
ld ret_lo, X+ |
66 |
LPM_R0_ZP |
LPM_R0_ZP |
67 |
sub ret_lo, r0 |
sub ret_lo, r0 |
68 |
brne .strncmp_P_done |
brne .L_strncmp_P_done |
69 |
tst r0 |
tst r0 |
70 |
brne .strncmp_P_loop |
brne .L_strncmp_P_loop |
71 |
.strncmp_P_equal: |
.L_strncmp_P_equal: |
72 |
sub ret_lo, ret_lo |
sub ret_lo, ret_lo |
73 |
.strncmp_P_done: |
.L_strncmp_P_done: |
74 |
; ret_hi = SREG.C ? 0xFF : 0 |
; ret_hi = SREG.C ? 0xFF : 0 |
75 |
sbc ret_hi, ret_hi |
sbc ret_hi, ret_hi |
76 |
ret |
ret |
77 |
.strncmp_P_end: |
.L_strncmp_P_end: |
78 |
.size _U(strncmp_P), .strncmp_P_end - _U(strncmp_P) |
.size _U(strncmp_P), .L_strncmp_P_end - _U(strncmp_P) |
79 |
|
|
80 |
#endif /* not DOXYGEN */ |
#endif /* not DOXYGEN */ |