Skip to content

andig/byteorder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

byteorder GoDoc

byteorder is a Go module for working with arbitrarily-ordered byte slices. It is useful e.g. when dealing with Modbus wire formats.

Installation:

go get github.com/andig/byteorder

Usage:

import "github.com/andig/byteorder"

// reverse byte order, i.e. little endian
bo := New("BA")
fmt.Printf("0x%04x", bo.Uint16([]byte{1, 2}))
// Output: 0x0201

NOTE: byteorder is not optimized for performance. The conversion functions will allocate which may not be desirable in high-frequency code paths.

In addition to the Go binary.ByteOrder implementation, this modules provides convenience functions for the ioBroker.modbus data types.

About

Easy to use arbitrarily-ordered encoding/binary.ByteOrder

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages