bits

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package bits provides functions for common bit operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToUint32

func BytesToUint32(bytes []byte) uint32

BytesToUint32 converts a byte slice to a uint32.

func GetBits

func GetBits(source uint64, upperBound int, lowerBound int) uint64

GetBits returns the bits within the provided bounds (inclusive). The requested bits are shifted to the LSB.

func Is32BitSignExt

func Is32BitSignExt(val uint64) (ret bool)

Is32BitSignExt returns true if the 64-bit value is a sign extended 32-bit value.

func SignExt

func SignExt(in uint64, signBit int) (out uint64)

SignExt updates all the bits beyond the signBit to be the same as the sign bit.

func Uint16ByteArray

func Uint16ByteArray(val uint16) [8]byte

Uint16ByteArray converts a uint16 to an array of bytes.

The length is determined by the transaction length with memory stores.

func Uint32ByteArray

func Uint32ByteArray(val uint32) [8]byte

Uint32ByteArray converts a uint32 to an array of bytes.

The length is determined by the transaction length with memory stores.

func Uint64ByteArray

func Uint64ByteArray(val uint64) [8]byte

Uint64ByteArray converts a uint64 to an array of bytes.

The length is determined by the transaction length with memory stores.

Types

This section is empty.

Jump to

Keyboard shortcuts

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