[Tutor] Preference to Bitwise operators in comparison to Logical operators

Manprit Singh manpritsinghece at gmail.com
Thu Sep 10 13:51:03 EDT 2020


Dear sir ,

Just need to ask you a question .
As we all know True is 1 and False is 0 .
Now
(1)  if the operands are True or  False  to logical operators and , or, not
 (2) and if operands are 1 or 0 to bitwise operators  x & y, x | y  and x ^
1
serves the same purpose , only difference is Logical operators will return
either True or False in this particular case .

Secondarily Bitwise operator gives extra operators  - XOR & Shifts
Secondarily bitwise operators are faster too.

What are your views on this? Kindly Guide .


More information about the Tutor mailing list