~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.
~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.