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

Derives for Eq and Hash #81

Closed
CryZe opened this issue Dec 22, 2021 · 2 comments · Fixed by #144
Closed

Derives for Eq and Hash #81

CryZe opened this issue Dec 22, 2021 · 2 comments · Fixed by #144

Comments

@CryZe
Copy link
Contributor

CryZe commented Dec 22, 2021

It probably makes sense to provide derives for Eq (and PartialEq) and Hash in bytemuck. On a Pod type Eq can be a simple memcmp / bcmp. Hashing is also much more efficient as you can provide all bytes at once.

@Lokathor
Copy link
Owner

Hm. I'm not against this, but I'll also note that f32 is pod, but a memcmp wouldn't be accurate for 0.0 and -0.0 (which are supposed to be equal).

@CryZe
Copy link
Contributor Author

CryZe commented Dec 22, 2021

Yeah, maybe the derives could be named ByteEq, ByteHash or so to clarify that?

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

Successfully merging a pull request may close this issue.

2 participants