bits

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func And

func And(a, b *big.Int) *big.Int

And returns the bitwise and of a and b.

func At added in v0.0.15

func At(x *big.Int, i uint) (uint, error)

At returns the value of the i'th bit of x.

func Clear

func Clear(a, b *big.Int) *big.Int

Clear returns the bitwise and not of a and b (a &^ b in Go).

func Len

func Len(x *big.Int) int

Len returns the length of the absolute value of x in bits. The bit length of 0 is 0.

func Lsh added in v0.0.15

func Lsh(x *big.Int, n uint) *big.Int

Lsh returns x shifted left by n bits.

func OnesCount

func OnesCount(x *big.Int) int

OnesCount returns the number of one bits ("population count") in x.

func Or

func Or(a, b *big.Int) *big.Int

Or returns the bitwise or of a and b (a | b in Go).

func Rsh added in v0.0.15

func Rsh(x *big.Int, n uint) *big.Int

Rsh returns x shifted right by n bits.

func Set added in v0.0.15

func Set(x *big.Int, i int, bit uint) *big.Int

SetBit returns x with x's i'th bit set to b (0 or 1). That is, if b is 1 SetBit returns x with its i'th bit set; if b is 0 SetBit returns x with its i'th bit cleared.

func Xor

func Xor(a, b *big.Int) *big.Int

Xor returns the bitwise xor of a and b (a ^ b in Go).

Types

This section is empty.

Jump to

Keyboard shortcuts

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