Master the fundamental concepts of memory optimization through this focused micro-challenge.
Networking headers, bloom-filter bitmaps, and game entity flags pack dozens of booleans into a few bytes. Bit packing cuts memory bandwidth and improves cache occupancy when you touch thousands of records per frame.
C bit-fields are convenient but implementation-defined. Manual shifts mask and store flags in uint32_t words for portable layouts.
cLoading…
Keep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will pack multiple small integers into one word and unpack them correctly. This exercise asks you to demonstrate memory savings on a large array of packed records.
Demonstrate bit packing to compress data structures.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github