Latest Tech News

Stay updated with the latest in technology, AI, cybersecurity, and more

Filtered by: u64 Clear Filter

Pointer Tagging in C++: The Art of Packing Bits into a Pointer

A 64-bit pointer can address over 18 exabytes (18 billion gigabytes) of memory, which far exceeds the needs of even the most top-end supercomputers. For this reason, most modern desktop CPUs only use 48 bits for virtual addresses, leaving the upper 16 bits unused. The bottom bits are typically underutilized, too. Most malloc implementations align allocations to 16-byte boundaries, so the bottom four bits are always set to zero. These bottom four bits can be repurposed to store extra data, as lo