https://github.com/torvalds/linux
Revision 6e1ab3ed825418320319f44af1b990c9c3f4c45b authored by Peter Mack on 22 April 2008, 11:25:11 UTC, committed by Greg Kroah-Hartman on 02 May 2008, 17:25:54 UTC
Add more usb device ids to the ftdi driver.

From: Peter Mack <Peter.Mack@scs-ptc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

1 parent e272252
Raw File
Tip revision: 6e1ab3ed825418320319f44af1b990c9c3f4c45b authored by Peter Mack on 22 April 2008, 11:25:11 UTC
USB: add more FTDI device ids
Tip revision: 6e1ab3e
int_sqrt.c

#include <linux/kernel.h>
#include <linux/module.h>

/**
 * int_sqrt - rough approximation to sqrt
 * @x: integer of which to calculate the sqrt
 *
 * A very rough approximation to the sqrt() function.
 */
unsigned long int_sqrt(unsigned long x)
{
	unsigned long op, res, one;

	op = x;
	res = 0;

	one = 1UL << (BITS_PER_LONG - 2);
	while (one > op)
		one >>= 2;

	while (one != 0) {
		if (op >= res + one) {
			op = op - (res + one);
			res = res +  2 * one;
		}
		res /= 2;
		one /= 4;
	}
	return res;
}
EXPORT_SYMBOL(int_sqrt);
back to top