]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/DriverSampleDxe: Make bit fields aligned in C structure
authorBi, Dandan <dandan.bi@intel.com>
Thu, 8 Feb 2018 14:28:39 +0000 (22:28 +0800)
committerLiming Gao <liming.gao@intel.com>
Fri, 9 Feb 2018 09:04:15 +0000 (17:04 +0800)
For a structure with a series of bit fields and used as a storage
in vfr file, and if the bit fields do not add up to the size of
the defined type.In the C code use sizeof() to get size of the
structure, the results may vary form the compiler(VS,GCC...).
But the size of the storage calculated by VfrCompiler is fixed
(calculate with alignment).To avoid the issue cased by above case,
we need to make the total width of the bit fields in the structure
aligned with the size of the defined type for these bit fields.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

No differences found