>>>>> "Paolo" == Paolo Bonzini <pbonz...@redhat.com> writes:

Paolo> 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);

Paolo> The magic that you wanted is

Paolo>    mfn |= -(mfn & 0x200);


Yes.  I'd actually been thinking of mfn -= 2 * (mfn & 0x200);
but forgot the 2*.  But the shifts should be faster, and that's wjhat
I'm testing at the moment.


Peter C
--
Dr Peter Chubb                                  peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au          Software Systems Research Group/NICTA

Reply via email to