Created
October 22, 2022 20:06
-
-
Save devendranaga/f52784b2bfaa11e6cf874ac74533093e to your computer and use it in GitHub Desktop.
htons in rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn htons(val: &u16) -> u16 { | |
return ((val & 0x00FF) << 8) | ((val & 0xFF00) >> 8) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment