bitwisebytes

package module
v0.0.0-...-ad9926f Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 5 Imported by: 1

README

Bitwisebytes

Build Status GoDoc Code Status

Bitwise operations on slices of bytes

Documentation

Index

Constants

View Source
const BitsWordSize = BytesWordSize * 8

BitsWordSize holds the number of bits in a uint word

View Source
const BytesWordSize = uint(unsafe.Sizeof(uint(0)))

BytesWordSize holds the size in bytes of a uint word

Variables

View Source
var BigEndian bigEndian

BigEndian is the big-endian implementation of ByteOrder.

View Source
var LittleEndian littleEndian

LittleEndian is the little-endian implementation of ByteOrder.

Functions

func And

func And(inputOutput []byte, operand []byte) (err error)

func ByteSliceToWordSlice

func ByteSliceToWordSlice(inputBytes []byte) (outputWords []uint)

ByteSliceToWordSlice converts a slice of bytes into a slice of words

func MakeMask

func MakeMask(size uint, width uint, offset uint) (outputMask []byte)

func Or

func Or(inputOutput []byte, operand []byte) (err error)

func ShiftLeft

func ShiftLeft(inputBuffer []byte, shiftCount uint) (outputBuffer []byte, err error)

ShiftLeft shifts a slice of bytes shiftCount bits to the left

func ShiftRight

func ShiftRight(inputBuffer []byte, shiftCount uint) (outputBuffer []byte, err error)

ShiftRight shifts a slice of bytes shiftCount bits to the right

func ShiftWordsSliceLeft

func ShiftWordsSliceLeft(buff []uint, shiftWords int) (returnBuff []uint)

ShiftWordsSliceLeft shifts a slice of words x words left

func ShiftWordsSliceRight

func ShiftWordsSliceRight(buff []uint, shiftWords int) (returnBuff []uint)

ShiftWordsSliceRight shifts a slice of words x words left

func WordSliceToByteSlice

func WordSliceToByteSlice(inputWords []uint) (outputBytes []byte)

BytesSliceToWordSlice converts a slice of words into a slice of bytes

Types

type ByteOrder

type ByteOrder interface {
	Uint8([]byte) uint8
	Uint16([]byte) uint16
	Uint24([]byte) uint32
	Uint32([]byte) uint32
	Uint40([]byte) uint64
	Uint48([]byte) uint64
	Uint56([]byte) uint64
	Uint64([]byte) uint64
	OrPutUint8([]byte, uint8)
	OrPutUint16([]byte, uint16)
	OrPutUint24([]byte, uint32)
	OrPutUint32([]byte, uint32)
	OrPutUint40([]byte, uint64)
	OrPutUint48([]byte, uint64)
	OrPutUint56([]byte, uint64)
	OrPutUint64([]byte, uint64)
}

ByteOrder specifies how to convert byte sequences into 16-, 32-, or 64-bit unsigned integers.

Jump to

Keyboard shortcuts

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