stdint

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Int128

type Int128 Uint128

type Uint128

type Uint128 struct {
	// contains filtered or unexported fields
}

Uint128 represents a Uint128 using two uint64s.

When the methods below mention a bit number, bit 0 is the most significant bit (in hi) and bit 127 is the lowest (lo&1).

NOTE: Uint128 is kept as struct instead of array because array of size > 1 doesn't go through SSA, see https://github.com/golang/go/issues/24416

func (Uint128) AND

func (u Uint128) AND(m Uint128) Uint128

AND returns the bitwise AND of u AND m (u&m).

func (Uint128) Add

func (u Uint128) Add(n Uint128) Uint128

func (Uint128) Add64

func (u Uint128) Add64(n uint64) Uint128

func (Uint128) AddOne

func (u Uint128) AddOne() Uint128

AddOne returns u + 1.

func (Uint128) Equals

func (u Uint128) Equals(o Uint128) bool

func (Uint128) IsZero

func (u Uint128) IsZero() bool

IsZero reports whether u == 0.

It's faster than u == (uint128{}) because the compiler (as of Go 1.15/1.16b1) doesn't do this trick and instead inserts a branch in its eq alg's generated code.

func (Uint128) NOT

func (u Uint128) NOT() Uint128

NOT returns the bitwise NOT of u.

func (Uint128) OR

func (u Uint128) OR(m Uint128) Uint128

OR returns the bitwise OR of u and m (u|m).

func (Uint128) Sub64

func (u Uint128) Sub64(n uint64) Uint128

func (Uint128) SubOne

func (u Uint128) SubOne() Uint128

SubOne returns u - 1.

func (Uint128) XOR

func (u Uint128) XOR(m Uint128) Uint128

XOR returns the bitwise XOR of u and m (u^m).

Jump to

Keyboard shortcuts

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