diff --git a/src/dataArg.c b/src/dataArg.c index 88d1138a6..4f2b4b5ad 100644 --- a/src/dataArg.c +++ b/src/dataArg.c @@ -85,8 +85,8 @@ uint8_t* content_init_hash(Hash nameHash, uint8_t* contentDir = nameDir + nameSize; uint8_t* typeDir = contentDir + size; - __platform_memcpy(nameDir, &nameHash, nameSize); // use hash - __platform_memcpy(typeDir, &type, typeSize); + *(Hash*)nameDir = nameHash; + *(ArgType*)typeDir = type; uint32_t* p_size = (uint32_t*)sizeDir; *p_size = size; if (NULL != content) { @@ -217,10 +217,9 @@ Arg* arg_setType(Arg* self, ArgType type) { } ArgType content_getType(uint8_t* self) { - void* type_ptr = (uint8_t*)self + content_typeOffset(self); - ArgType type; - __platform_memcpy(&type, type_ptr, sizeof(ArgType)); - return type; + ArgType* type_ptr = + (ArgType*)((uintptr_t)self + (uintptr_t)content_typeOffset(self)); + return *type_ptr; } uint16_t content_contentOffset(uint8_t* self) {