raw
raw copied to clipboard
htons should depend on host endianness
func htons should take host endianness into account:
func htons(i uint16) uint16 {
return (i<<8)&0xff00 | i>>8
}
Depending on host endianness this should be a no-op or not.
The issue was spotted when trying to use this lib on a device with a different endianness...