From: Hans de G. <hde...@re...> - 2011-02-10 07:40:36
|
Hi, On 02/10/2011 03:05 AM, Segher Boessenkool wrote: >>>> The field is a long int, not a uint64_t. Can we change that, or >>>> is the struct exposed via the libusb API? >> >> libusb_device_handle is defined in libusbi.h. It is opaque in libusb.h. >> I >> don't see an obvious problem with changing it. > > Thanks for checking. > > So I guess we should: > 1) Fix all checks to be against the #define'd constant, not the size > of the field; I think we all agree on that? +1 > 2) Maybe change the data type of the field; not very necessary, it > will save some space, perhaps create a tiny bit more efficient code; I don't think we should change the type, long gives us 32 bits guaranteed, without needing any platform specific magic. > 3) Either or not apply Hans' patch, it's not needed anymore in > practice if we did 1); I actually first saw this issue with (1 << bitnr) rather then (1L << bitnr) for a mask for a long in the kernel ages ago, where it broke joystick buttons on 64 bit machines. Moral of the story if you are building a mask to mask a long variable use 1L not 1. So if we keep claimed_interfaces as a long, I would still like to see the masks changed to 1L for correctness. Regards, Hans |