Slice to `[u8;4]`
Slice to `[u8;4]`
Posted Oct 4, 2024 11:41 UTC (Fri) by geert (subscriber, #98403)In reply to: Slice to `[u8;4]` by farnz
Parent article: A discussion of Rust safety documentation
About the new version: Wow, writing that much code to generate a function with a single asm instruction...
Posted Oct 4, 2024 11:55 UTC (Fri)
by farnz (subscriber, #17727)
[Link]
The reason there's so much code for one asm instruction is that most of the code is concerned with things that asm doesn't care about - asm doesn't care if you're reading out of bounds (that's a CPU fault at worst, and a program bug at best), or if you're asking it to read from the "wrong" location, or a whole host of other things that programming languages care about.
And it's similar in size to the dance you need to do with standard C to get the same instruction.
Slice to `[u8;4]`