---
title: "bitwise operations"
type: concept
source: https://www.jemoka.com/posts/kbhbitwise_operations/
confidence: high
status: active
---

&amp; | ~ ^ &lt;&lt; &gt;&gt;
&amp; Bitwise level AND
| Bitwise level OR
~ Unary bitwise negation
^ Unary XOR
&lt;&lt; Shift the number to the left. Fill unused slots with 0.
&gt;&gt; Shift the number to the right
for signed values, we perform an arithmetic right shift: fill the unused slots with the most significant bit from before (&ldquo;fill with 1s&rdquo;) for unsigned values, we perform a logical right shift
