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

Useless byte order conversions #37

Closed
jarkkojs opened this issue Nov 28, 2018 · 1 comment
Closed

Useless byte order conversions #37

jarkkojs opened this issue Nov 28, 2018 · 1 comment

Comments

@jarkkojs
Copy link
Collaborator

jarkkojs commented Nov 28, 2018

Example: vt_write_int32BE('sub3');". This works if the compiler has right semantics but could be just as well truncate (e.g. just take 's'). No well defined semantice in C++ standard AFAIK.

Everything is basically wrong there. You could define byte arrays that have the data already in correct byte order (i.e. big endian in the example) and have named costants for them (e.g. SUB32_BE). In addition fixing the compiler warnings that gives a minor performance improvement as you don't end up doing useless byte order conversions constantly...

And that would also be fully cross platform, works both little and big endian hardware platforms.

@jarkkojs
Copy link
Collaborator Author

jarkkojs commented Dec 5, 2018

Closing this as gained better understanding of the code.

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

1 participant