56 |
.global _U(strnlen_P) |
.global _U(strnlen_P) |
57 |
.type _U(strnlen_P), @function |
.type _U(strnlen_P), @function |
58 |
_U(strnlen_P): |
_U(strnlen_P): |
59 |
LOAD_Z(src_lo, src_hi) |
X_movw ZL, src_lo |
60 |
1: |
.L_strnlen_P_loop: |
61 |
LPM_R0_ZP |
LPM_R0_ZP |
62 |
subi len_lo, lo8(1) |
subi len_lo, lo8(1) |
63 |
sbci len_hi, hi8(1) |
sbci len_hi, hi8(1) |
64 |
cpse r0, __zero_reg__ |
cpse r0, __zero_reg__ |
65 |
brcc 1b |
brcc .L_strnlen_P_loop |
66 |
; Z points one character past the terminating NUL |
; Z points one character past the terminating NUL |
67 |
; return Z - 1 - src = (-1 - src) + Z = ~src + Z |
; return Z - 1 - src = (-1 - src) + Z = ~src + Z |
68 |
com src_lo |
com src_lo |
70 |
add src_lo, ZL |
add src_lo, ZL |
71 |
adc src_hi, ZH |
adc src_hi, ZH |
72 |
ret |
ret |
73 |
.Lstrnlen_P_end: |
.L_strnlen_P_end: |
74 |
.size _U(strnlen_P), .Lstrnlen_P_end - _U(strnlen_P) |
.size _U(strnlen_P), .L_strnlen_P_end - _U(strnlen_P) |
75 |
|
|
76 |
#endif /* not __DOXYGEN__ */ |
#endif /* not __DOXYGEN__ */ |