From fbba0ff6a0ce56304c8b6c558dd298d3a03c99d0 Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 5 Apr 2014 21:55:02 +0300 Subject: [PATCH] make memcpy32/memset32 take void * --- pico/misc.c | 13 +++++++++---- pico/pico_int.h | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pico/misc.c b/pico/misc.c index f9e85cda..a500ac8c 100644 --- a/pico/misc.c +++ b/pico/misc.c @@ -125,21 +125,26 @@ PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count) } #ifndef _ASM_MISC_C_AMIPS -PICO_INTERNAL_ASM void memcpy32(int *dest, int *src, int count) +PICO_INTERNAL_ASM void memcpy32(void *dest_in, const void *src_in, int count) { - intblock *bd = (intblock *) dest, *bs = (intblock *) src; + const intblock *bs = (intblock *) src_in; + intblock *bd = (intblock *) dest_in; + const int *src; + int *dest; for (; count >= sizeof(*bd)/4; count -= sizeof(*bd)/4) *bd++ = *bs++; - dest = (int *)bd; src = (int *)bs; + dest = (int *)bd; src = (const int *)bs; while (count--) *dest++ = *src++; } -PICO_INTERNAL_ASM void memset32(int *dest, int c, int count) +PICO_INTERNAL_ASM void memset32(void *dest_in, int c, int count) { + int *dest = dest_in; + for (; count >= 8; count -= 8, dest += 8) dest[0] = dest[1] = dest[2] = dest[3] = dest[4] = dest[5] = dest[6] = dest[7] = c; diff --git a/pico/pico_int.h b/pico/pico_int.h index 7447db94..c85319c0 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -770,8 +770,8 @@ extern int (*PicoDmaHook)(unsigned int source, int len, unsigned short **srcp, u // misc.c PICO_INTERNAL_ASM void memcpy16(unsigned short *dest, unsigned short *src, int count); PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count); -PICO_INTERNAL_ASM void memcpy32(int *dest, int *src, int count); // 32bit word count -PICO_INTERNAL_ASM void memset32(int *dest, int c, int count); +PICO_INTERNAL_ASM void memcpy32(void *dest, const void *src, int count); // 32bit word count +PICO_INTERNAL_ASM void memset32(void *dest, int c, int count); // eeprom.c void EEPROM_write8(unsigned int a, unsigned int d); -- 2.39.5