endian

package module
v0.0.0-...-29b3a41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2015 License: Apache-2.0 Imports: 0 Imported by: 1

README

endian GoDoc

A small golang library to help deal with host-to-network and network-to-host endianness conversion

Disclaimer

Before using this library, please read and understand Rob Pike's blog post on the byte order fallacy. Long story short, whenever you need to worry about whether or not your code is running on a little endian or big endian machine, chances are you're wrong in your approach and should instead really be thinking about writing the code in an endianness-agnostic way, as Rob shows in his blog post.

In the limited cases where you do need to swap bytes around (perhaps because you call into a library that is "doing it wrong"), this small library can help.

Documentation

Overview

Package endian provides helper functions to deal with network byte order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostToNetUint16

func HostToNetUint16(n uint16) uint16

HostToNetUint16 swaps the bytes of the given value (if necessary) to turn them from network byte order to host byte order.

func HostToNetUint32

func HostToNetUint32(n uint32) uint32

HostToNetUint32 swaps the bytes of the given value (if necessary) to turn them from network byte order to host byte order.

func HostToNetUint64

func HostToNetUint64(n uint64) uint64

HostToNetUint64 swaps the bytes of the given value (if necessary) to turn them from network byte order to host byte order.

func NetToHostUint16

func NetToHostUint16(n uint16) uint16

NetToHostUint16 swaps the bytes of the given value (if necessary) to turn them from network byte order to host byte order.

func NetToHostUint32

func NetToHostUint32(n uint32) uint32

NetToHostUint32 swaps the bytes of the given value (if necessary) to turn them from network byte order to host byte order.

func NetToHostUint64

func NetToHostUint64(n uint64) uint64

NetToHostUint64 swaps the bytes of the given value (if necessary) to turn them from network byte order to host byte order.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL