Remix.run Logo
Retr0id 3 hours ago

Also, endian-correct code is usually semantically clearer. For example, if you're reading network-ordered bytes into an int, an unconditional endian swap (which will produce correct results on LE systems but not BE) is less clear than invoking a "network bytes to u32" helper.

namibj 29 minutes ago | parent [-]

u32::from_be_bytes

u32::from_le_bytes

u32::from_ne_bytes the n stands for native