Clever Bit Manipulation Hacks in C for High-Frequency Systems
Swapping variables without temporary storage, checking power of two using bitwise AND, and clearing trailing bits instantly.
A daily tech dispatch focused on C/C++, Rust, Assembly, Kernel Internal Architecture, SIMD Optimization, and Reverse Engineering.
; Fast bitwise shift optimization in x86_64
global _start
section .text
_start:
mov rax, 0xDEADBEEF ; Load target hex into accumulator
shl rax, 4 ; Shift bits left by 4 positions
xor rbx, rbx ; Clear register
ret
Swapping variables without temporary storage, checking power of two using bitwise AND, and clearing trailing bits instantly.
How slab allocators reduce fragmentation and how alignment padding affects CPU cache line performance.
A practical walkthrough analyzing stripped ELF binaries, locating entry points, and decompiling register states.