gz / rust-cpuid

cpuid library in rust.
https://docs.rs/raw-cpuid/
MIT License
151 stars 45 forks source link

Replace as_bytes with safe code #39

Closed niklasf closed 3 years ago

niklasf commented 3 years ago

~Is it intentional that the conversion in as_bytes() depends on the endianness?~

~If yes, there should maybe be a comment mentioning it.~

~I think it is not, so it may be best to replace it with a (not much longer) version without unsafe.~

Nevermind the endianness question. I guess x86 is just always little endian. I believe it's still best to avoid unsafe code, when the safe version is not significantly longer or slower.

gz commented 3 years ago

This makes total sense, thanks for submitting this!