Re: [PATCH 1/7] USB: add urb->ep

David Brownell <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Monday 30 July 2007, Alan Stern wrote:
>                 /* power of two? */
> -               while (temp > urb->interval)
> -                       temp >>= 1;
> -               urb->interval = temp;
> +               while (max > urb->interval)
> +                       max >>= 1;
> +               urb->interval = max;

#include <linux/log2.h>

	if (urb->interval > max)
		urb->interval = max
	else
		urb->interval = ilog2(urb->interval);

or somesuch?  That previous code is a bit opaque, and the
loop can often be replaced by a single instruction.

Related:  consider making urb->interval and its neighbors
be "u32" or maybe even "u16".

- Dave


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.