Unions P196 1 unsigned float2bit(float f) 2{ union I 345678 float f unsigned ui f temp temp. f=fi return temp.ui 9}; movI8(ebp) 号eax 16
16 Unions P196 1 unsigned float2bit(float f) 2 { 3 union { 4 float f; 5 unsigned u; 6 } temp; 7 temp.f = f; 8 return temp.u; 9 }; 1 movl 8(%ebp), %eax
Unions 1 unsigned float2bit(float f) 2{ union I 345678 float f unsigned ui f temp temp. f=fi return temp.ui 1m。vL 8(ebp) beax
17 Unions 1 unsigned float2bit(float f) 2 { 3 union { 4 float f; 5 unsigned u; 6 } temp; 7 temp.f = f; 8 return temp.u; 9 }; 1 movl 8(%ebp), %eax
Unions(Code generated identical to the procedure) 1 unsigned copy (unsigned u) return ui movI8(ebp) gear
18 Unions (Code generated identical to the procedure) 1 unsigned copy (unsigned u) 2 { 3 return u; 4 } 1 movl 8(%ebp), %eax
Alignment P198 Alignment restrictions The address for some type of object must be a multiple of some value k(typically 2, 4, or 8) Simplify the hardware design of the interface between the processor and the memory system
19 Alignment P198 • Alignment restrictions – The address for some type of object must be a multiple of some value k (typically 2, 4, or 8) – Simplify the hardware design of the interface between the processor and the memory system
Alignment In工A32 hardware will work correctly regardless of the alignment of data Aligned data can improve memory system performance
20 Alignment • In IA32 – hardware will work correctly regardless of the alignment of data – Aligned data can improve memory system performance