Array Endianness: Endianness is only applicable to single variables, ie. only to each array element value, not to the order of elements in the array.
Notice val+1
is equivalent of &val[1]
, not bit addition
Multi-dimentional
multi dimensional array does not align up memory within itself
Array-of-Array
Array Access Practice:
Memory location of primitive are determined at compile time
The order of memory remains the same as declare order (even though other orderings can run faster)
Motivation
Memory accessed by (aligned) chunks of 4 or 8 bytes (system dependent)
Inefficient to load or store datum that spans cache lines (64 bytes). Intel states should avoid crossing 16 byte boundaries.
Virtual memory trickier when datum spans 2 pages (4 KB pages)
Note: to save space, order elements in struct by increasing or decreasing order
TODO: don't want to write this part
Table of Content