5-1 Parity >> vs >>>

#1

I was looking at the brute force algorithm, and I was wondering why we used >>, arithmetic shift rather than >>>, logical shift. If we are looking for the number of bits in the number, does that include the signed bit? If we shift with >>, then we create another 1 every time we shift.

0 Likes

#2

I think you are right, in this situation, logical shift is more appropriate because arithmetic shift may cause incorrect result. Thanks for your excellent discussion and please keep doing this.

0 Likes

#3

Thanks so much! Super honored to receive a response from the author. :smile:

0 Likes