Documentation
¶
Index ¶
- type Bits
- type Bits16
- func (Bits16) Add(x, y, carry uint16) (sum, carryOut uint16)
- func (Bits16) And(x, y uint16) uint16
- func (Bits16) Cmp(x, y uint16) int
- func (Bits16) Dec(x uint16) uint16
- func (Bits16) Div(hi, lo, y uint16) (quo, rem uint16)
- func (Bits16) Eq(x, y uint16) bool
- func (Bits16) FromInt(i int) uint16
- func (Bits16) Gt(x, y uint16) bool
- func (Bits16) Gte(x, y uint16) bool
- func (Bits16) Inc(x uint16) uint16
- func (Bits16) Int(x uint16) int
- func (b Bits16) IsZero(x uint16) bool
- func (Bits16) Lt(x, y uint16) bool
- func (Bits16) Lte(x, y uint16) bool
- func (Bits16) Lzcnt(x uint16) int
- func (Bits16) Mask(x, mask uint16) uint16
- func (Bits16) MaskInsert(x, y, mask uint16) uint16
- func (Bits16) Mul(x, y uint16) (hi, lo uint16)
- func (Bits16) Neq(x, y uint16) bool
- func (Bits16) Not(x uint16) uint16
- func (Bits16) Or(x, y uint16) uint16
- func (Bits16) Pow2(x int) uint16
- func (Bits16) Pow2m1(x int) uint16
- func (Bits16) Rotl(x uint16, k int) uint16
- func (Bits16) Shl(x uint16, k int) uint16
- func (Bits16) Shr(x uint16, k int) uint16
- func (Bits16) Sub(x, y, borrow uint16) (diff, borrowOut uint16)
- func (Bits16) Xor(x, y uint16) uint16
- type Bits32
- func (Bits32) Add(x, y, carry uint32) (sum, carryOut uint32)
- func (Bits32) And(x, y uint32) uint32
- func (Bits32) Cmp(x, y uint32) int
- func (Bits32) Dec(x uint32) uint32
- func (Bits32) Div(hi, lo, y uint32) (quo, rem uint32)
- func (Bits32) Eq(x, y uint32) bool
- func (Bits32) FromInt(i int) uint32
- func (Bits32) Gt(x, y uint32) bool
- func (Bits32) Gte(x, y uint32) bool
- func (Bits32) Inc(x uint32) uint32
- func (Bits32) Int(x uint32) int
- func (b Bits32) IsZero(x uint32) bool
- func (Bits32) Lt(x, y uint32) bool
- func (Bits32) Lte(x, y uint32) bool
- func (Bits32) Lzcnt(x uint32) int
- func (Bits32) Mask(x, mask uint32) uint32
- func (Bits32) MaskInsert(x, y, mask uint32) uint32
- func (Bits32) Mul(x, y uint32) (hi, lo uint32)
- func (Bits32) Neq(x, y uint32) bool
- func (Bits32) Not(x uint32) uint32
- func (Bits32) Or(x, y uint32) uint32
- func (Bits32) Pow2(x int) uint32
- func (Bits32) Pow2m1(x int) uint32
- func (Bits32) Rotl(x uint32, k int) uint32
- func (Bits32) Shl(x uint32, k int) uint32
- func (Bits32) Shr(x uint32, k int) uint32
- func (Bits32) Sub(x, y, borrow uint32) (diff, borrowOut uint32)
- func (Bits32) Xor(x, y uint32) uint32
- type Bits64
- func (Bits64) Add(x, y, carry uint64) (sum, carryOut uint64)
- func (Bits64) And(x, y uint64) uint64
- func (Bits64) Cmp(x, y uint64) int
- func (Bits64) Dec(x uint64) uint64
- func (Bits64) Div(hi, lo, y uint64) (quo, rem uint64)
- func (Bits64) Eq(x, y uint64) bool
- func (Bits64) FromInt(i int) uint64
- func (Bits64) Gt(x, y uint64) bool
- func (Bits64) Gte(x, y uint64) bool
- func (Bits64) Inc(x uint64) uint64
- func (Bits64) Int(x uint64) int
- func (b Bits64) IsZero(x uint64) bool
- func (Bits64) Lt(x, y uint64) bool
- func (Bits64) Lte(x, y uint64) bool
- func (Bits64) Lzcnt(x uint64) int
- func (Bits64) Mask(x, mask uint64) uint64
- func (Bits64) MaskInsert(x, y, mask uint64) uint64
- func (Bits64) Mul(x, y uint64) (hi, lo uint64)
- func (Bits64) Neq(x, y uint64) bool
- func (Bits64) Not(x uint64) uint64
- func (Bits64) Or(x, y uint64) uint64
- func (Bits64) Pow2(x int) uint64
- func (Bits64) Pow2m1(x int) uint64
- func (Bits64) Rotl(x uint64, k int) uint64
- func (Bits64) Shl(x uint64, k int) uint64
- func (Bits64) Shr(x uint64, k int) uint64
- func (Bits64) Sub(x, y, borrow uint64) (diff, borrowOut uint64)
- func (Bits64) Xor(x, y uint64) uint64
- type Bits128
- func (Bits128) Add(x, y, carry Uint128) (sum, carryOut Uint128)
- func (Bits128) And(x, y Uint128) Uint128
- func (Bits128) Cmp(x, y Uint128) int
- func (b Bits128) Dec(x Uint128) Uint128
- func (Bits128) Div(hi, lo, y Uint128) (quo, rem Uint128)
- func (b Bits128) Eq(x, y Uint128) bool
- func (Bits128) FromInt(i int) (u Uint128)
- func (b Bits128) Gt(x, y Uint128) bool
- func (b Bits128) Gte(x, y Uint128) bool
- func (b Bits128) Inc(x Uint128) Uint128
- func (Bits128) Int(x Uint128) int
- func (b Bits128) IsZero(x Uint128) bool
- func (b Bits128) Lt(x, y Uint128) bool
- func (b Bits128) Lte(x, y Uint128) bool
- func (Bits128) Lzcnt(x Uint128) int
- func (Bits128) Mask(x, mask Uint128) Uint128
- func (Bits128) MaskInsert(x, y, mask Uint128) Uint128
- func (b Bits128) Mul(x, y Uint128) (hi, lo Uint128)
- func (b Bits128) Neq(x, y Uint128) bool
- func (Bits128) Not(x Uint128) Uint128
- func (Bits128) Or(x, y Uint128) Uint128
- func (Bits128) Pow2(x int) Uint128
- func (Bits128) Pow2m1(x int) Uint128
- func (Bits128) Rotl(x Uint128, k int) (r Uint128)
- func (Bits128) Shl(x Uint128, k int) (r Uint128)
- func (Bits128) Shr(x Uint128, k int) Uint128
- func (Bits128) Sub(x, y, borrow Uint128) (diff, borrowOut Uint128)
- func (Bits128) Xor(x, y Uint128) Uint128
- type Uint
- type Uint16
- type Uint32
- type Uint64
- type Uint128
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bits ¶
type Bits[U Uint] interface { Int(x U) int FromInt(int) U Add(x, y, carry U) (sum, carryOut U) Sub(x, y, borrow U) (diff, borrowOut U) Inc(x U) U Dec(x U) U Mul(x, y U) (hi, lo U) Div(hi, lo, y U) (quo, rem U) Not(U) U Or(x, y U) U And(x, y U) U Mask(x, mask U) U MaskInsert(x, y, mask U) U Xor(x, y U) U Rotl(x U, k int) U Pow2(x int) U Pow2m1(x int) U Shl(x U, k int) U Shr(x U, k int) U Lzcnt(x U) int Cmp(x, y U) int Eq(x, y U) bool Neq(x, y U) bool Lt(x, y U) bool Lte(x, y U) bool Gt(x, y U) bool Gte(x, y U) bool // Usefully, avoid needing to declare zero values. IsZero(x U) bool }
Bits defines a generic interface of operations upon a Uint.
type Bits16 ¶
type Bits16 struct{}
Bits16 provides a genericable surface to abstract uint16 math.
func (Bits16) MaskInsert ¶
MaskInsert composes masking out the mask bits from x with ORing in the mask bits of y.
func (Bits16) Pow2 ¶
Pow2 returns the integer power of two.
It is undefined behavior to use an x greater than or equal to the bit width.
func (Bits16) Pow2m1 ¶
Pow2m1 returns the integer power of two minus one.
It is undefined behavior to use an x greater than the bit width.
type Bits32 ¶
type Bits32 struct{}
Bits32 provides a genericable surface to abstract uint32 math.
func (Bits32) MaskInsert ¶
MaskInsert composes masking out the mask bits from x with ORing in the mask bits of y.
func (Bits32) Pow2 ¶
Pow2 returns the integer power of two.
It is undefined behavior to use an x greater than or equal to the bit width.
func (Bits32) Pow2m1 ¶
Pow2m1 returns the integer power of two minus one.
It is undefined behavior to use an x greater than the bit width.
func (Bits32) Sub ¶
Sub is bits.Sub32.
type Bits64 ¶
type Bits64 struct{}
Bits64 provides a genericable surface to abstract uint64 math.
func (Bits64) MaskInsert ¶
MaskInsert composes masking out the mask bits from x with ORing in the mask bits of y.
func (Bits64) Pow2 ¶
Pow2 returns the integer power of two.
It is undefined behavior to use an x greater than or equal to the bit width.
func (Bits64) Pow2m1 ¶
Pow2m1 returns the integer power of two minus one.
It is undefined behavior to use an x greater than the bit width.
func (Bits64) Sub ¶
Sub is bits.Sub64.
type Bits128 ¶
type Bits128 struct{}
Bits128 provides a genericable surface to abstract uint64 math.
func (Bits128) Int ¶
Int converts to an int.
This is a simple cast, and will discard bits above strconv.IntSize.
func (Bits128) MaskInsert ¶
MaskInsert composes masking out the mask bits from x with ORing in the mask bits of y.
func (Bits128) Pow2 ¶
Pow2 returns the integer power of two.
It is undefined behavior to use an x greater than or equal to the bit width.
func (Bits128) Pow2m1 ¶
Pow2m1 returns the integer power of two minus one.
It is undefined behavior to use an x greater than the bit width.
type Uint16 ¶
type Uint16 = uint16
Uint16 is an alias to uint16, to provide name consistency with Uint128.
type Uint32 ¶
type Uint32 = uint32
Uint32 is an alias to uint32, to provide name consistency with Uint128.