What is a bit-shifting standard C function for calculating $f(x) = \frac{(2^{16}- 1)}{(2^{32} - 1)}\cdot x$ I need to take 32-bit unsigned integers and scale them to 16-bit unsigned integers "evenly" so that $0 \mapsto 0$ and 0xFFFFFFFF $\mapsto$ 0xFFFF.  I also want to do this without using a 64-bit unsigned integer built-in type.
To give you an idea, going in the opposite direction, the formula for 16-bit to 32-bit scaling is:
U16 y = 0x3290;   // example input
U32 x = ((U32)y << 16) + y;      // formula implementation

To arrive at the formula in the title, I simply took two points on the line that is the graph of $f$, and calculated the slope and y-intercept, like in Alg 1. 
Those are the rules.  Good luck!

You're probably better off asking this on a programming forum.
That said, simply doing division is probably your best bet: not only does it make it obvious what you are doing, but the compiler is likely to automatically convert it to bit shifts for you anyways. And even if it doesn't, there's a good chance that it doesn't even matter whether or not you are doing this calculation efficiently!
Note, incidentally, that you haven't specified how you want to do the rounding....

Anyways, the standard algorithm for converting division by arbitrary divisors into division by powers of $2$ (along with some multiplies and adds/subtracts) is called "Barrett reduction".
