Re: [cc65] Double star?

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-02-25 20:41:06


On Tue, Feb 25, 2003 at 08:33:19PM +0100, M Ancher wrote:
> The prototype for "xmemmove" is:
> static void xmemmove(uchar *dst, uchar *src, uint32 size)

The function expects an "uchar*" as first and second parameter, but you're
passing an "WClassStruct**" for both. So the compiler is right, it's the code
that is invalid.

If xmemmove() should act like memmove(), then I would suggest calling
memmove() instead, because memmove() is a hand optimized assembler subroutine.
And, memmove() takes two void pointers, so the call will work. Another
solution is to rewrite xmemmove() accordingly. If you're going to rewrite
xmemmove(), please note that declaring the third parameter as uint32 is
useless and leads to bloated code. Since the address space of the 6502 is only
16 bits, a copy function does not need to handle a 32 bit counter. In general,
any 32 bit variable that is a counter or similar thing should be checked and
replaced by a 16 bit variable if possible. See topic 4 in coding.html:

    4. Longs are slow!

    While long support is necessary for some things, it's really, really slow
    on the 6502. Remember that any long variable will use 4 bytes of memory,
    and any operation works on double the data compared to an int.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-02-25 20:41:15 CET