Zulip Chat Archive

Stream: lean4

Topic: Marshalling lean UInt* into byte arrays


Siddharth Bhat (Mar 23 2024 at 23:40):

I'm starting to write this type of code again, that converts a UInt* into a ByteArray and/or writes it out into a file for marshalling things like ELF and WAV files. What's the correct place for me to PR this? I assume it is std? I'm happy to put up a quick PR that takes a UInt* and produces a ByteArray. I imagine that longer term there's going to be a serde equivalent?

Kim Morrison (Mar 24 2024 at 00:32):

Isn't (x &&& 0xff).toUInt8 the same as x.toUInt8?

Kim Morrison (Mar 24 2024 at 00:32):

I'm not sure what you're proposing PRing. Functions UInt*.toByteArray? A class ToByteArray and instances for UInt*?

Kim Morrison (Mar 24 2024 at 00:33):

Could this just start off as its own repo?

Timo Carlin-Burns (Mar 24 2024 at 00:47):

I think UInt*.to{Be,Le,Ne}Bytes should be welcome in Std. Rust has them


Last updated: May 02 2025 at 03:31 UTC