Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible unneeded packing of structs #973

Open
th-otto opened this issue Mar 22, 2024 · 2 comments
Open

Possible unneeded packing of structs #973

th-otto opened this issue Mar 22, 2024 · 2 comments

Comments

@th-otto
Copy link
Contributor

th-otto commented Mar 22, 2024

There are some structures like

typedef struct BITFIELD_STRUCT
that are declared with pack(1) and also attribute((ms_struct)) However, since they also contain pointers, they are certainly not used anywhere where files and/or network data is accessed. Declaring it in the current way causes inefficient code to be used on architectures that don't allow unaligned accesses, and also slows down accesses to the member on architectures that allow it.

@OmniBlade
Copy link
Contributor

Its possible they were swept up in the work to get cross platform LAN play working and don't need to be packed or the bitfield done a particular way. If you want to test network play between a client that has had these statements removed vs one that hasn't and verify they are still able to connect and play then they are probably safe to remove.

@th-otto
Copy link
Contributor Author

th-otto commented Mar 22, 2024

I have a bit difficulty in testing this, since you apparently cannot run both the client and server on the same machine.

BTW, i also found that in tiberian dawn, a lot of network related types are duplicate in defines.h and session.h. But unlike redalert, session.h does not seem to be used at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants