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/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to