2 ms·
Only if makes the overall structure actually becomes smaller. A bunch of these shorts were surrounded by fields whose alignment means that changing to int resul
by mikeash 10y ago
Only if makes the overall structure actually becomes smaller. A bunch of these shorts were surrounded by fields whose alignment means that changing to int results in no increase in the overall size of the structure. In fact, I think some of them actually got smaller due to reordering the fields to be more alignment-friendly.
- andrewprock 10y agoStruct packing is something you can control at the compiler level. In gcc, you can add __attribute__((__packed__)) to your structs.
- mikeash 10y agoThat can add a performance penalty. If it didn't, compilers would always pack tightly, after all. In any case, these particular structs don't have any special packing applied.