Skip to main content

Practice · 4 of 4

Alignment Helper

CHALLENGE
Difficulty: advanced+25 XP

Implement unsigned char *align_up(unsigned char *p, size_t align) returning the smallest address >= p that is a multiple of align (align is a power of two). This is the helper every arena needs before handing out typed slices.

Back to lesson: Practice: Allocator Engineering Drills