mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-06 12:37:54 +02:00
89 lines
4.4 KiB
XML
89 lines
4.4 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
|
<style>
|
|
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
|
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
|
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
|
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
|
.dim{font:20px 'Courier New',monospace;fill:#888}
|
|
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
|
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
|
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
|
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
|
.badge{stroke:#00ff41;rx:14}
|
|
</style>
|
|
<rect class="bg" width="1200" height="800"/>
|
|
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
|
<text class="title" x="600" y="52" text-anchor="middle">Bitwise & Assignment</text>
|
|
<text class="dim" x="600" y="88" text-anchor="middle">Bit Manipulation and Compound Assignment</text>
|
|
|
|
<!-- Bitwise Panel -->
|
|
<rect class="pnl" x="30" y="110" width="555" height="370" rx="8"/>
|
|
<text class="sub" x="50" y="145">Bitwise Operators</text>
|
|
<rect x="50" y="160" width="515" height="200" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
|
<text class="amb" x="70" y="190"><<</text>
|
|
<text class="dim" x="140" y="190">6 << 1 = 12</text>
|
|
<text class="dim" x="360" y="190">Left shift</text>
|
|
<text class="amb" x="70" y="220">>></text>
|
|
<text class="dim" x="140" y="220">6 >> 1 = 3</text>
|
|
<text class="dim" x="360" y="220">Right shift</text>
|
|
<text class="amb" x="70" y="250">&</text>
|
|
<text class="dim" x="140" y="250">6 & 3 = 2</text>
|
|
<text class="dim" x="360" y="250">AND</text>
|
|
<text class="amb" x="70" y="280">|</text>
|
|
<text class="dim" x="140" y="280">6 | 3 = 7</text>
|
|
<text class="dim" x="360" y="280">OR</text>
|
|
<text class="amb" x="70" y="310">^</text>
|
|
<text class="dim" x="140" y="310">6 ^ 3 = 5</text>
|
|
<text class="dim" x="360" y="310">XOR</text>
|
|
<text class="amb" x="70" y="340">~</text>
|
|
<text class="dim" x="140" y="340">~6</text>
|
|
<text class="dim" x="360" y="340">NOT (invert)</text>
|
|
|
|
<!-- Left shift diagram -->
|
|
<text class="dim" x="50" y="390">Left shift = multiply by 2</text>
|
|
<rect x="50" y="400" width="515" height="60" rx="4" fill="#0a0a0f" stroke="#00ff41" stroke-width="1"/>
|
|
<text class="grn" x="70" y="425">0 0 0 0 0 1 1 0</text>
|
|
<text class="dim" x="370" y="425">= 6</text>
|
|
<text class="grn" x="70" y="448">0 0 0 0 1 1 0 0</text>
|
|
<text class="dim" x="370" y="448">= 12</text>
|
|
|
|
<!-- Assignment Panel -->
|
|
<rect class="pnl" x="615" y="110" width="555" height="370" rx="8"/>
|
|
<text class="sub" x="635" y="145">Assignment Operators</text>
|
|
<text class="dim" x="635" y="175">Shorthand for math + assign</text>
|
|
<rect x="635" y="190" width="515" height="200" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
|
<text class="amb" x="655" y="220">+=</text>
|
|
<text class="dim" x="720" y="220">x += 5</text>
|
|
<text class="dim" x="905" y="220">x = x + 5</text>
|
|
<text class="amb" x="655" y="255">-=</text>
|
|
<text class="dim" x="720" y="255">x -= 2</text>
|
|
<text class="dim" x="905" y="255">x = x - 2</text>
|
|
<text class="amb" x="655" y="290">*=</text>
|
|
<text class="dim" x="720" y="290">x *= 3</text>
|
|
<text class="dim" x="905" y="290">x = x * 3</text>
|
|
<text class="amb" x="655" y="325">/=</text>
|
|
<text class="dim" x="720" y="325">x /= 2</text>
|
|
<text class="dim" x="905" y="325">x = x / 2</text>
|
|
<text class="amb" x="655" y="360">%=</text>
|
|
<text class="dim" x="720" y="360">x %= 4</text>
|
|
<text class="dim" x="905" y="360">x = x % 4</text>
|
|
|
|
<!-- Code example -->
|
|
<text class="dim" x="635" y="415">In our code (x=6 after x++):</text>
|
|
<rect x="635" y="425" width="515" height="45" rx="4" fill="#0a0a0f" stroke="#ffaa00" stroke-width="1"/>
|
|
<text class="amb" x="655" y="453">x += 5 --> 6 + 5 = 11</text>
|
|
|
|
<!-- Bottom -->
|
|
<rect class="pnl" x="30" y="495" width="1140" height="120" rx="8"/>
|
|
<text class="sub" x="50" y="530">In Our Code (x=6, y=10)</text>
|
|
<rect x="50" y="545" width="1100" height="50" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
|
<text class="cyn" x="70" y="575">int bitwise = (x<<1);</text>
|
|
<text class="dim" x="500" y="575">6 << 1 = 12 (0b0110 --> 0b1100)</text>
|
|
|
|
<!-- Binary output preview -->
|
|
<rect class="pnl" x="30" y="630" width="1140" height="110" rx="8"/>
|
|
<text class="sub" x="50" y="665">Expected Output</text>
|
|
<text class="txt" x="50" y="700">bitwise_operator: 12</text>
|
|
<text class="txt" x="470" y="700">assignment_operator: 11</text>
|
|
<text class="dim" x="50" y="725">Both pre-computed by compiler as immediates</text>
|
|
</svg> |