Il 23/04/2012 22:54, Peter Chubb ha scritto: > Peter> What is this calculation supposed to do? It doesn't convert a > Peter> 10-bit signed twos-complement number into an int32_t, unless > Peter> I'm confused... Also, it's a rather opaque way to write "mfn &= > Peter> 0x200;". > > I'll use a different way to calculate. Maybe: > mfn <<= (32-10); > mfn >>= (32-10);
The magic that you wanted is mfn |= -(mfn & 0x200); :) but I do prefer the shifts too. Paolo