#alignment
Wiki
›
Algorithms
›
02. Data Structures
›
1. Core Data Structures and Operations
›
1.1 Arrays and Dynamic Arrays
›
Alignment
Array Alignment Array alignment controls where elements begin in memory. Many processors access aligned values more efficiently because the value fits cleanly inside one memory word, cache line, or vector register. You use it when low-level performance, SIMD instructions, or binary layout compatibility matters. Problem Given an array $A$ whose element type requires alignment $a$, ensure that every element address satisfies: $$ address(A[i]) \bmod a = 0 $$ for every...