From 6011bdb2f63c86424fbd6e321d3eee3408b61b62 Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Wed, 17 May 2017 10:00:35 +0200 Subject: [PATCH] Optimize the inlined strlen. --- src/cc65/stdfunc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 */