Closed tc-hib closed 3 years ago
Uhhhh, the original (size+7)&^7
looks completely brain-dead broken to me here now; what the funk did I try to do here?!? should I actually be probably using (-size)&3
here, to make the padding fill up to next multiple of 4? https://play.golang.org/p/WeafpPVVVGj
Your formula is smart 👍 Yes, you can do -size&7
.
We align on 8 bytes instead of 4 because that's what Microsoft does now (and windres too), though it used to be 4 bytes, and both should do.
Looks like you forgot to subtract actual data size. This should explain why rsrc v0.10.0 didn't really align data, and made bigger syso files.
But, to me, this hardly explains why it was so much slower. I suppose the magical function that explores the data directory with reflection was looping through the
Padding
slice?