[Spice-devel] aspeed: video frames pass-through

Anton D. Kachalov mouse at yandex-team.ru
Wed Nov 18 06:35:03 PST 2015



18.11.2015, 17:29, "Anton D. Kachalov" <mouse at yandex-team.ru>:
> Hi.
>
>
> struct {
>   uint16_t foo;
>   uint32_t bar;
> }
>
> What alignment would be on "bar" access (ptr address input for read_uint32)?

This might work:

uint32_t read_uint32(uint8_t *ptr) {
   return ptr[3] << 24 | ... | ptr[0];
}

but question in the byte-access overhead code versus memcpy code.

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

memcpy should be definitely better choice for float/double reads/writes. Meanwhile, current protocol doesn't have such fields' types.

-- 
Anton D. Kachalov


More information about the Spice-devel mailing list