usbatm cxacru.c,1.18,1.19

Duncan Sands baldrick at free.fr
Fri Mar 4 09:01:28 EST 2005


On Fri, 2005-03-04 at 16:56 +0300, Roman Kagan wrote:
> On Fri, Mar 04, 2005 at 01:57:33PM +0100, Duncan Sands wrote:
> > I think it would be wiser to define a struct with two 16 bit fields:
> > 
> > struct signature_struct {
> > 	__le16 idVendor;
> > 	__le16 idProduct;
> > } __attribute__ ((packed));
> > 
> > and just write idVendor and idProduct into it.
> 
> Is the way I did it:
> 
> > +	u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct };
> 
> worse than what you suggest?  No bit-shift operators anymore.

What if the compiler aligns the array elements on 32 bit boundaries?
I don't know if gcc does that, or what the standard has to say.

Ciao,

D.




More information about the Usbatm mailing list