>>> "mips32_pracc_read_mem" casts uint32 to void, so we need to cast it
>>> back to uint32. I found no suitable macro in actual sources.
>>
>> Hmm.... then I think we ought to define one to get this put to
>> bed once and for all...
>  
> static inline uint32_t uint32_read_unaligned(const void *data)
> {
> uint32_t t;
>  // Let's trust the compiler to do something very clever here.
> memcpy(&t, data, sizeof(t));
> return t;
> }

Do we really need a memcpy? Could we ever run into an alignment issue when 
simply cast void *back* to uint32 ? If not, I would prefer the simplifed 
solution.

static inline uint32_t h_to_h_u32(const void *data)
{
  return (uint32_t)*data;
}

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to