The non-template version takes in an s32 alignment. If the alignment is positive, it rounds up. For completion, if the alignment is negative, it rounds down. The return value is the change in m_index as a result. It has a default parameter of 4; we typically target 32-bit files, so we assume that struct alignment is 4.
The template version would align to the nearest valid index for a given parseable type. We ensure that it's a parseable type, as if we are aligning for a struct, the non-template version should be used instead.
It would look something like this:
The non-template version takes in an
s32
alignment. If the alignment is positive, it rounds up. For completion, if the alignment is negative, it rounds down. The return value is the change inm_index
as a result. It has a default parameter of 4; we typically target 32-bit files, so we assume that struct alignment is 4.The template version would align to the nearest valid index for a given parseable type. We ensure that it's a parseable type, as if we are aligning for a struct, the non-template version should be used instead.