SPRAC71B February 2019 – October 2023
Structure members are assigned offsets starting at 0. Each member is assigned the lowest available offset that satisfies its alignment. Padding may be required between members to satisfy this alignment constraint.
Union members are all assigned an offset of 0.
The underlying representation of a C++ class is a structure. Elsewhere in this document the term structure applies to classes as well.
The alignment requirement of a structure or union is equal to the most strict alignment requirement among its members, including bit field containers as described in the next section. The size of a structure or union in memory is rounded up to a multiple of its alignment by inserting padding after the last member. Structures and unions passed by value on the stack have special alignment rules as specified in Section 3.3.
In general, structures having size 32 bits or less may reside in registers or register pairs while being passed to or returned from functions. Such structures are passed by value in the R0H-R3H registers, then by value on the stack. Single field structures are passed and returned by value corresponding to the underlying scalar type. See Section 3.5 for information about larger structures and unions passed and returned by reference.
For devices that support FPU32 or FPU64, homogeneous float structures with a size less than 128 bits are passed by value. In addition, for devices that support FPU64, 64-bit doubles (R0-R3) are passed by value.
In little-endian mode a structure in a register is always right justified; that is, the first byte occupies the LSB of the register (the even register if a pair) and subsequent bytes of the structure are filled into the increasingly significant bytes of the register(s). The C28x uses little-endian mode only.