mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-21 14:22:26 +00:00
7311e9b4b8
* Implement `ByteEq` and `ByteHash` derives This adds the derives `ByteEq` and `ByteHash` that can be used as an alternative to the `Eq` / `PartialEq` and `Hash` derives from the standard library. The difference is that these variants use `bytemuck` to convert their values to byte slices before comparing / hashing them. This allows the comparisons to turn into a simple `memcmp` / `bcmp` (or completely inlined as a few vector instructions) and allows hashers to process all bytes at once, possibly allowing for some vector operations as well. Here's a quick comparison of the generated assembly: ![https://i.imgur.com/CGTSWTZ.png](https://i.imgur.com/CGTSWTZ.png) * Address review comments |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml | ||
changelog.md | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
LICENSE-ZLIB | ||
README.md |