Commit 42e4284f authored by Jeroen Vreeken's avatar Jeroen Vreeken Committed by Michel Roelofs
Browse files

Use memcpy instead of assignment

parent 9976a7ae
...@@ -46,11 +46,13 @@ do {\ ...@@ -46,11 +46,13 @@ do {\
u.v = (val); \ u.v = (val); \
\ \
if (!strcmp(#type, "double")) { \ if (!strcmp(#type, "double")) { \
*(double *)&vadyn->regs[vadyn->fp_offset] = u.d;\ memcpy(&vadyn->regs[vadyn->fp_offset], &u.d, sizeof(u.d)); \
/* *(double *)&vadyn->regs[vadyn->fp_offset] = u.d;*/\
vadyn->fp_offset += sizeof(long double);\ vadyn->fp_offset += sizeof(long double);\
} else { \ } else { \
*(unsigned long *)&vadyn->regs[vadyn->gp_offset] = \ memcpy(&vadyn->regs[vadyn->gp_offset], &u.ul, sizeof(u.ul)); \
(unsigned long)u.ul;\ /* *(unsigned long *)&vadyn->regs[vadyn->gp_offset] = \
(unsigned long)u.ul;*/\
vadyn->gp_offset += sizeof(unsigned long);\ vadyn->gp_offset += sizeof(unsigned long);\
} \ } \
} while (0) } while (0)
...@@ -78,13 +80,14 @@ do { \ ...@@ -78,13 +80,14 @@ do { \
do { \ do { \
char *ptr; \ char *ptr; \
char **clist = (char **)(list); \ char **clist = (char **)(list); \
type tmpval = val; \
size_t size; \ size_t size; \
\ \
size = ((size_t)clist[-1] - (size_t)(list)); \ size = ((size_t)clist[-1] - (size_t)(list)); \
clist = realloc(&clist[-1], size + sizeof(type) + sizeof(char *)) + sizeof(char *); \ clist = realloc(&clist[-1], size + sizeof(type) + sizeof(char *)) + sizeof(char *); \
(list) = (void *)clist; \ (list) = (void *)clist; \
ptr = ((char *)clist + size); \ ptr = ((char *)clist + size); \
*(type *)ptr = (val); \ memcpy(ptr, &tmpval, sizeof(tmpval)); \
clist[-1] = ptr + sizeof(type); \ clist[-1] = ptr + sizeof(type); \
} while (0) } while (0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment