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

Christophe Fergeau cfergeau at redhat.com
Wed Nov 18 06:46:41 PST 2015


On Wed, Nov 18, 2015 at 05:29:32PM +0300, Anton D. Kachalov wrote:
> Hi.
> 
> 18.11.2015, 17:06, "Christophe Fergeau" <cfergeau at 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.

Oh yeah could definitely work better, not very familiar with this kind of problems
:)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151118/d9faae0a/attachment.sig>


More information about the Spice-devel mailing list