4.3.4 UEFI Data Type Sizes

Note that a few UEFI data types are different sizes on 32-bit architectures versus 64bit architectures as follow:
  • Pointers
  • Enumerations
  • INTN
  • UINTN
The result of these differing types is that that any complex types, such as unions and data structures, that are composed of these base types also have different sizes on 32bit architectures versus 64-bit architectures. These differences must be kept in mind whenever the sizeof() operator is used.
If a union or data structure is required that does not change size between 32-bit and 64-bit architectures, then no changes are required.
For interoperability, only the data types defined in the Calling Conventions section of the UEFI Specification should be used. Some of these data types change based on the selected compiler, and should not cause a fault in the code. If a new data type is defined, then an alignment fault or other error could be generated.