Can bitwise left-shift (<<
) and right-shift (>>
) operators be implemented using only AND (&
), OR (|
), XOR (^
), NOT (~
)?
Asked
Active
Viewed 38 times
0

Geremia
- 4,745
- 37
- 43
-
5No. At minimum you need one operation where the result for one bit can influence what happens with a neighboring bit. – njuffa Dec 06 '18 at 17:21
-
@njuffa Now that I think about, yes, you're right; there'd be no way to influence neighboring bits. – Geremia Dec 06 '18 at 17:36