mybits

package
v0.0.0-...-e05d22d Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 2 Imported by: 0

README

mybits

This is a collection of functions for bit-manipulative stuff.

The most important thing in here is the encoder and decoder for our event tile bitmaps. This is documented at the top of onoff.c

In addition, we compile the onoff decoder into a WASM module.

Test/debug the native C code

See debug/test-bits.c and debug/test-onoff.c

Test the Go interface

go test .

Build and test the WASM code

./build-wasm && node test-wasm.mjs

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOutOfSpace = errors.New("out of buffer space")

Functions

func DecodeOnoff

func DecodeOnoff(enc []byte, out []byte) (int, error)

Returns the number of BITS decoded. Returns ErrOutOfSpace if the decoded bit stream is larger than 'out'

func DecodeOnoff3

func DecodeOnoff3(enc []byte, out []byte) (int, error)

Returns the number of BITS decoded. Returns ErrOutOfSpace if the decoded bit stream is larger than 'out'

func EncodeOnoff

func EncodeOnoff(bits []byte, out []byte) (int, error)

Encode the given bit stream using out on/off encoding. Returns the number of bytes written into 'out'. If the resulting bit stream ends up being larger than 'out', then abort and return ErrOutOfSpace.

func EncodeOnoff3

func EncodeOnoff3(bits []byte, out []byte) (int, error)

Final version

Types

This section is empty.

Jump to

Keyboard shortcuts

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