From: SourceForge.net <no...@so...> - 2012-06-27 12:50:36
|
Feature Requests item #3538387, was opened at 2012-06-27 05:47 Message generated for change (Settings changed) made by spth You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=350599&aid=3538387&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: z80 port Group: None Status: Open Priority: 3 Private: No Submitted By: Philipp Klaus Krause (spth) Assigned to: Nobody/Anonymous (nobody) Summary: Built-in strchr(), strcpy(), strncpy() Initial Comment: These three functions could be provided as built-ins: strchr(): %2: ld a, (hl) cp a, b jr Z, %1 or a, a inc hl jr NZ, %2 ld l, a ld h, a %1: This is ten bytes long, 2 more than a call strchr(). But it leaves bc, de and iy alone. It can be customized depending on operand location (any reg or literal in place of b, any pair in place of hl). strcpy(): xor a, a %1: ldi cp a, (hl) jr NZ, %1 this is 6 bytes, one shorter than a call to strcpy(), and it leaves iy alone. strncpy(): xor a, a %2: ldi jr Z, %1 cp a, (hl) jr NZ, %2 %1: This is 8 bytes, one shorter than the call to strncpy(), and it leaves iy alone. These string functions are far less common than memcpy() and memset(), which are already implemented as built-in, so I set the priority lower than the default. Philipp ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=350599&aid=3538387&group_id=599 |