Skip to content

Conversation

mejedi
Copy link
Contributor

@mejedi mejedi commented Jan 23, 2025

Rename "htons" package to "endian". Htons stands for "host to network short (uint16)". If we ever add helpers for other integer widths, "htons" for the package name would not fit.

Rewrite Htons itself without unsafe, making the code easier to follow and helping the compiler generate tighter code.

Rename "htons" package to "endian". Htons stands for "host to network
short (uint16)". If we ever add helpers for other integer
widths, "htons" for the package name would not fit.

Rewrite Htons itself without unsafe, making the code easier to follow
and helping the compiler generate tighter code.

Signed-off-by: Nick Zavaritsky <mejedi@gmail.com>
Copy link
Contributor

@mosajjal mosajjal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mosajjal mosajjal self-assigned this Jan 24, 2025
@mosajjal mosajjal merged commit 4bc8c8e into gopacket:master Jan 24, 2025
1 check passed
@mejedi mejedi deleted the htons-cleanup branch January 25, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants