Hi,
On 06/29/2012 04:03 PM, Anand Chitipothu wrote:
> On Fri, Jun 29, 2012 at 3:40 PM, Varun Narang wrote:
>> Hi all,
>>
>> I need some help understanding the right shift operation on -9. To my
>> understanding, it's represented as -0b1001, Now, if I shift it one place to
>> right, it should give
On Fri, Jun 29, 2012 at 3:40 PM, Varun Narang wrote:
> Hi all,
>
> I need some help understanding the right shift operation on -9. To my
> understanding, it's represented as -0b1001, Now, if I shift it one place to
> right, it should give me -0b0100, which is decimal equivalent of 4. but
> running
Varun Narang writes:
> I need some help understanding the right shift operation on -9. To my
> understanding, it's represented as -0b1001,
No. Integers are represented using 2s complement integers. So -9 will
actually be represented by 0xfff7. When you shift it to the right, a
'1' is shifted
Hi all,
I need some help understanding the right shift operation on -9. To my
understanding, it's represented as -0b1001, Now, if I shift it one place to
right, it should give me -0b0100, which is decimal equivalent of 4. but
running this on python console gives me -5.
Please help me out here.
T