-
-
Notifications
You must be signed in to change notification settings - Fork 380
#630 transmute_vec_as_bytes potential fix #662
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
Conversation
…ly handle padding for usize and f32 types
chore(FyroxEngine#630): reformatting transmute_vec_as_bytes to properly handle padding for usize and f32 types
sync repositories
Hi, this looks like a partial solution. May I ask you, could you please try using |
I have added Using If this approach sounds acceptable, I'll proceed with the necessary changes. errors: --> fyrox-impl/src/scene/terrain/mod.rs:116:9 |
Yes, you can proceed. As for |
…nsmute_vec_as_bytes to have the generic T implement pod trait
Transmute vec as bytes 630
Made the suggested changes and left the unit tests. |
Hey all new here but believe this may fix the issue raised in #630. Added some comments on the issue thread including a playground which shows the result of the old function versus the new function. I have taken an approach to only account for the specific types which actually are used in the codebase (f32 and usize) as there were a lot of issues dealing with a totally generic type. I understand this adds a limitation that was previously not there, if this is not a good approach let me know and I can do some reformatting.
I have added two unit tests for transmute_vec_as_bytes which makes sure the results do not include any random values from the padding.
I removed the need for an unsafe block because the types are known to the function, and did not add any dependencies to the project.
All unit tests are passing, and running my modified tutorials from the RPG and FPS on the documentation seem to run the same as on the master branch of the main fork. This is my first PR here if there's anything I can do to improve it let me know!