Skip to content

joshlf/gopack

Repository files navigation

gopack Build Status

Bitpacking for Go.

##Usage

// Define arbitrary structs for packing.
type color struct {
  R, G, B uint8
}

red := color{255, 0, 0}
b := make([]byte, 3)
gopack.Pack(b, red)

// Use field tags to specify custom bit widths.
type unixMode struct {
  User, Group, Other uint8 `gopack:"3"`
}

// Embed structs nested arbitrarily deep.
type file struct {
  Size uint32
  Mode unixMode
}

// Unexported fields are ignored.
type person struct {
  name string
  Age uint8
}

// Use int types and bool types.
type fileHandle struct {
  File file
  Open bool
  Seek uint32
}

##Documentation

See the documentation.

About

Bitpacking for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages