Hi.

18.11.2015, 17:06, "Christophe Fergeau" <cferg...@redhat.com>:
> Hey,
[...]
> By 'alignment-safe', I mean:
> static uint16_t read_uint16(unsigned uint16_t *ptr)

Do you mean "uint8_t *ptr"?

> {
>     return (ptr[1] << 8) || ptr[0];
> }
> (or a macro version of it)

Would compiler generate byte-access code? It should. What about source "ptr" 
alignment? How this code would manage such struct:

struct {
  uint16_t foo;
  uint32_t bar;
}

What alignment would be on "bar" access (ptr address input for read_uint32)?

May be better to use memcpy? It is align-safe.

> Yup, I'm suggesting 2. above. Maybe it will be best to make these
> code-paths ARM specific.

I'll try to rewrite with memcpy and check.

-- 
Anton D. Kachalov
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to