/* While the USB HID spec allows unlimited length bit fields in "report
descriptors", most devices never use more than 16 bits. One model of UPS is claimed to report "LINEV" as a 32-bit field. Search linux-kernel and linux-usb-devel archives for "hid-core extract".  */
static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
/* While the USB HID spec allows unlimited length bit fields in "report
descriptors", most devices never use more than 16 bits. One model of UPS is claimed to report "LINEV" as a 32-bit field. Search linux-kernel and linux-usb-devel archives for "hid-core extract".  */
static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
{
	u64 x;
	if (n > 32)
		printk(KERN_WARNING "HID: extract() called with n (%d) > 32! (%s)\n",
				n, current->comm);
	report += offset >> 3;
	offset &= 7;
	x = get_unaligned_le64(report);
	x = (x >> offset) & ((1ULL << n) - 1);
	return (u32) x;
}