Make AudioFrame trivially copyable, and remove extraneous warning delints#120840
Conversation
c17557f to
1b0eed7
Compare
|
Seems that this code was intentional. This PR basically brings us back to the state before #87006 |
It doesn't, it was The original PR is a (small) performance hazard in hindsight (making this type not trivially copyable and not |
196ef7b to
346d210
Compare
346d210 to
5a88421
Compare
hpvb
left a comment
There was a problem hiding this comment.
The exact right amount of cursed.
|
I retract the below statement. After talking it through with @Ivorforce it seems obvious that the standard already guarantees for the cases we care about. Thanks for humoring me! DetailsLooking at this a bit more (because I was reviewing #120845), I think maybe we should add one more static assert to this (And all of the changes in #120845) It is perhaps super pedantic, but what else am I here for:Like, in practice I don't think there's really any case where this can't hold, but if we're doing the static asserts anyway... |
|
We resolved the above comment in chat. Practically, the guarantee follows from the "first member is at offset 0" guarantee + the "every member is placed at its correct alignment" guarantee. This can only hold if the owning struct's alignment is at least that of each of its fields. |
|
Thanks! |
What problem(s) does this PR solve?
AudioFrameis currently not trivially copyable.While perhaps optimizable in later compiler stages, it is unnecessary to rely on this. It should be cleaned up.
Additional information
I also made
Vector2conversions explicit. Besides being a core goal,Vector2usesreal_twhileAudioFrameusesfloatso there's real risk of data loss.