Cirrus Logic CS485 Bedienungsanleitung Seite 31

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 67
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 30
CS485G Spring 2015 31
(b) 2 bytes (short): address ends with 0
2
(c) 4 bytes (int, void *): address ends with 00
2
(d) 8 bytes (double): address ends with 000
2
(Linux/x86 compilers
choose 00
2
).
(e) 12 bytes (long double): Linux/x86 chooses 00
2
.
4. The x86 64 is stricter
(a) 8 bytes (double, void *): address ends with 000
2
(b) 16 bytes (long double): Linux/x86 chooses 000
2
.
5. On some machines alignment is mandatory.
6. Motivation
(a) The CPU accesses memory in chunks of 4 or 8 bytes (architecture-
dependent).
(b) It is inefficient to access a datum that crosses chunk boundaries.
(c) It is tricky to access a datum that crosses page boundaries (typ-
ically every 4KB).
7. The compiler can add padding to accomplish this requirement:
c x
pad x+1 (pad of 3 bytes)
y x+4
pad x+12 (pad of 4 bytes)
v x+16
end x+24
8. The compiler can also re-order the fields (biggest first, for instance)
to reduce the amount of padding.
9. The entire struct needs to be padded to a multiple of the largest
primitive data within the struct, so that arrays of such structs
work.
32 Midterm test 3/2/2015
33 Discussion of midterm test
1. Lecture 17, 3/4/2015
Seitenansicht 30
1 2 ... 26 27 28 29 30 31 32 33 34 35 36 ... 66 67

Kommentare zu diesen Handbüchern

Keine Kommentare