From: Piotr Fusik Date: Wed, 17 May 2017 08:00:35 +0000 (+0200) Subject: Optimize the inlined strlen. X-Git-Tag: V2.17~143^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6011bdb2f63c86424fbd6e321d3eee3408b61b62;p=cc65 Optimize the inlined strlen. --- diff --git a/src/cc65/stdfunc.c b/src/cc65/stdfunc.c index 7a0450146..f658f0dcb 100644 --- a/src/cc65/stdfunc.c +++ b/src/cc65/stdfunc.c @@ -1245,9 +1245,8 @@ static void StdFunc_strlen (FuncDesc* F attribute ((unused)), ExprDesc* Expr) AddCodeLine ("ldy #$FF"); g_defcodelabel (L); AddCodeLine ("iny"); - AddCodeLine ("lda %s,y", ED_GetLabelName (&Arg, 0)); + AddCodeLine ("ldx %s,y", ED_GetLabelName (&Arg, 0)); AddCodeLine ("bne %s", LocalLabelName (L)); - AddCodeLine ("tax"); AddCodeLine ("tya"); /* The function result is an rvalue in the primary register */