Speykious / cve-rs

Blazingly 🔥 fast 🚀 memory vulnerabilities, written in 100% safe Rust. 🦀
Other
3.72k stars 94 forks source link

Optimize transmute #31

Open turalcar opened 4 months ago

turalcar commented 4 months ago

Don't use boxes: Not only this avoids allocation but also makes no_std implementation possible. I didn't bother to rewrite the comment (it's not like I entirely understand how it works anyway). but there are 2 main issues to consider: 1) Alignment: union Blank has both the max size and max alignment of its arguments 2) Niches: for some implementation-defined reason this combination of Options and Result works. We likely use the fact that union have no niches.

Together with removing black_box and inline(never) this achieves performance identical with std on my ARMv8.