You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was working on some serialization code, and noticed that the .Float and .Bool cases weren't handled in byteSwapAllFields. I moved the scalar cases into byteSwap and call them from byteSwapAllFields.
i dont agree that std.mem.byteSwap() should exist. the fix should remain localized to byteSwapAllFields. people should always prefer @byteSwap in the general case and they wont necessarily if this function exists
That's fair, I figured since there was common logic I would move it to that method. Also since @byteSwap doesn't work on floats, it means the user doesn't have to write that logic themselves.
That's fair, I figured since there was common logic I would move it to that method.
totally
Also since @byteSwap doesn't work on floats, it means the user doesn't have to write that logic themselves.
this might be worth a separate issue. there could be a reason why floats and enums are not supported or it could be a simple oversight and no one's mentioned it before. would love to learn more about the use case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
release notesThis PR should be mentioned in the release notes.standard libraryThis issue involves writing Zig code for the standard library.
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was working on some serialization code, and noticed that the
.Floatand.Boolcases weren't handled inbyteSwapAllFields. I moved the scalar cases intobyteSwapand call them frombyteSwapAllFields.