Oliver Neukum <[EMAIL PROTECTED]> writes:
> Am Mittwoch, 7. Februar 2007 18:31 schrieb Pete Zaitcev:
>> On Wed, 7 Feb 2007 14:39:28 +0100, Oliver Neukum <[EMAIL PROTECTED]> wrote:
>> > Am Mittwoch, 7. Februar 2007 14:31 schrieb Sergei Organov:
>>
>> > > static inline unsigned usb_get_uint16(__u8 const *p)
>> > > {
>> > > return p[0] | (p[1] << 8);
>> > > }
>> >
>> > It makes little sense to reinvent le16_to_cpu()
>>
>> It would not, if le16_to_cpu took a pointer to u8. But as it is,
>> functions are quite different.
>
> That's what casts are for. However, why do you have no type information
> in the first place? Untyped data is risky.
Because wrongly typed data is even more risky ;)
Unfortunately I can't have the correct type for this field in C (it
should be "2-bytes-little-endian-unsigned-integer-unaligned"), so I
can't get type-safety here anyway. Declaring this field __le16 is IMHO a
poor attempt as it creates an illusion of type safety when in fact there
is no type safety guaranteed.
-- Sergei.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel