Namespace: go.std.math.bits
v1.0Contents
Summary
Provides a low-level interface to the math/bits package.
Package bits implements bit counting and manipulation
functions for the predeclared unsigned integer types.
Index
- Add
- Add32
- Add64
- Div
- Div32
- Div64
- LeadingZeros
- LeadingZeros16
- LeadingZeros32
- LeadingZeros64
- LeadingZeros8
- Len
- Len16
- Len32
- Len64
- Len8
- Mul
- Mul32
- Mul64
- OnesCount
- OnesCount16
- OnesCount32
- OnesCount64
- OnesCount8
- Rem
- Rem32
- Rem64
- Reverse
- Reverse16
- Reverse32
- Reverse64
- Reverse8
- ReverseBytes
- ReverseBytes16
- ReverseBytes32
- ReverseBytes64
- RotateLeft
- RotateLeft16
- RotateLeft32
- RotateLeft64
- RotateLeft8
- Sub
- Sub32
- Sub64
- TrailingZeros
- TrailingZeros16
- TrailingZeros32
- TrailingZeros64
- TrailingZeros8
- UintSize
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
UintSize
Int v1.0UintSize is the size of a uint in bits.
Variables
-
(None.)
Functions, Macros, and Special Forms
-
Add
Function v1.0(Add x y carry)
Add returns the sum with carry of x, y and carry: sum = x + y + carry.
The carry input must be 0 or 1; otherwise the behavior is undefined.
The carryOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint, y uint, carry uint)
Go returns: (sum uint, carryOut uint)
Joker input arguments: [^Number x, ^Number y, ^Number carry]
Joker returns: [^Number sum, ^Number carryOut] -
Add32
Function v1.0(Add32 x y carry)
Add32 returns the sum with carry of x, y and carry: sum = x + y + carry.
The carry input must be 0 or 1; otherwise the behavior is undefined.
The carryOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint32, y uint32, carry uint32)
Go returns: (sum uint32, carryOut uint32)
Joker input arguments: [^Number x, ^Number y, ^Number carry]
Joker returns: [^Number sum, ^Number carryOut] -
Add64
Function v1.0(Add64 x y carry)
Add64 returns the sum with carry of x, y and carry: sum = x + y + carry.
The carry input must be 0 or 1; otherwise the behavior is undefined.
The carryOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint64, y uint64, carry uint64)
Go returns: (sum uint64, carryOut uint64)
Joker input arguments: [^Number x, ^Number y, ^Number carry]
Joker returns: [^Number sum, ^Number carryOut] -
Div
Function v1.0(Div hi lo y)
Div returns the quotient and remainder of (hi, lo) divided by y:
quo = (hi, lo)/y, rem = (hi, lo)%y with the dividend bits' upper
half in parameter hi and the lower half in parameter lo.
Div panics for y == 0 (division by zero) or y <= hi (quotient overflow).
Go input arguments: (hi uint, lo uint, y uint)
Go returns: (quo uint, rem uint)
Joker input arguments: [^Number hi, ^Number lo, ^Number y]
Joker returns: [^Number quo, ^Number rem] -
Div32
Function v1.0(Div32 hi lo y)
Div32 returns the quotient and remainder of (hi, lo) divided by y:
quo = (hi, lo)/y, rem = (hi, lo)%y with the dividend bits' upper
half in parameter hi and the lower half in parameter lo.
Div32 panics for y == 0 (division by zero) or y <= hi (quotient overflow).
Go input arguments: (hi uint32, lo uint32, y uint32)
Go returns: (quo uint32, rem uint32)
Joker input arguments: [^Number hi, ^Number lo, ^Number y]
Joker returns: [^Number quo, ^Number rem] -
Div64
Function v1.0(Div64 hi lo y)
Div64 returns the quotient and remainder of (hi, lo) divided by y:
quo = (hi, lo)/y, rem = (hi, lo)%y with the dividend bits' upper
half in parameter hi and the lower half in parameter lo.
Div64 panics for y == 0 (division by zero) or y <= hi (quotient overflow).
Go input arguments: (hi uint64, lo uint64, y uint64)
Go returns: (quo uint64, rem uint64)
Joker input arguments: [^Number hi, ^Number lo, ^Number y]
Joker returns: [^Number quo, ^Number rem] -
LeadingZeros
Function v1.0(LeadingZeros x)
LeadingZeros returns the number of leading zero bits in x; the result is UintSize for x == 0.
Go input arguments: (x uint)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
LeadingZeros16
Function v1.0(LeadingZeros16 x)
LeadingZeros16 returns the number of leading zero bits in x; the result is 16 for x == 0.
Go input arguments: (x uint16)
Go returns: int
Joker input arguments: [^Int x]
Joker returns: ^Int -
LeadingZeros32
Function v1.0(LeadingZeros32 x)
LeadingZeros32 returns the number of leading zero bits in x; the result is 32 for x == 0.
Go input arguments: (x uint32)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
LeadingZeros64
Function v1.0(LeadingZeros64 x)
LeadingZeros64 returns the number of leading zero bits in x; the result is 64 for x == 0.
Go input arguments: (x uint64)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
LeadingZeros8
Function v1.0(LeadingZeros8 x)
LeadingZeros8 returns the number of leading zero bits in x; the result is 8 for x == 0.
Go input arguments: (x uint8)
Go returns: int
Joker input arguments: [^Int x]
Joker returns: ^Int -
Len
Function v1.0(Len x)
Len returns the minimum number of bits required to represent x; the result is 0 for x == 0.
Go input arguments: (x uint)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
Len16
Function v1.0(Len16 x)
Len16 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
Go input arguments: (x uint16)
Go returns: int
Joker input arguments: [^Int x]
Joker returns: ^Int n -
Len32
Function v1.0(Len32 x)
Len32 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
Go input arguments: (x uint32)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int n -
Len64
Function v1.0(Len64 x)
Len64 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
Go input arguments: (x uint64)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int n -
Len8
Function v1.0(Len8 x)
Len8 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
Go input arguments: (x uint8)
Go returns: int
Joker input arguments: [^Int x]
Joker returns: ^Int -
Mul
Function v1.0(Mul x y)
Mul returns the full-width product of x and y: (hi, lo) = x * y
with the product bits' upper half returned in hi and the lower
half returned in lo.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint, y uint)
Go returns: (hi uint, lo uint)
Joker input arguments: [^Number x, ^Number y]
Joker returns: [^Number hi, ^Number lo] -
Mul32
Function v1.0(Mul32 x y)
Mul32 returns the 64-bit product of x and y: (hi, lo) = x * y
with the product bits' upper half returned in hi and the lower
half returned in lo.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint32, y uint32)
Go returns: (hi uint32, lo uint32)
Joker input arguments: [^Number x, ^Number y]
Joker returns: [^Number hi, ^Number lo] -
Mul64
Function v1.0(Mul64 x y)
Mul64 returns the 128-bit product of x and y: (hi, lo) = x * y
with the product bits' upper half returned in hi and the lower
half returned in lo.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint64, y uint64)
Go returns: (hi uint64, lo uint64)
Joker input arguments: [^Number x, ^Number y]
Joker returns: [^Number hi, ^Number lo] -
OnesCount
Function v1.0(OnesCount x)
OnesCount returns the number of one bits ("population count") in x.
Go input arguments: (x uint)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
OnesCount16
Function v1.0(OnesCount16 x)
OnesCount16 returns the number of one bits ("population count") in x.
Go input arguments: (x uint16)
Go returns: int
Joker input arguments: [^Int x]
Joker returns: ^Int -
OnesCount32
Function v1.0(OnesCount32 x)
OnesCount32 returns the number of one bits ("population count") in x.
Go input arguments: (x uint32)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
OnesCount64
Function v1.0(OnesCount64 x)
OnesCount64 returns the number of one bits ("population count") in x.
Go input arguments: (x uint64)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
OnesCount8
Function v1.0(OnesCount8 x)
OnesCount8 returns the number of one bits ("population count") in x.
Go input arguments: (x uint8)
Go returns: int
Joker input arguments: [^Int x]
Joker returns: ^Int -
Rem
Function v1.0(Rem hi lo y)
Rem returns the remainder of (hi, lo) divided by y. Rem panics for
y == 0 (division by zero) but, unlike Div, it doesn't panic on a
quotient overflow.
Go input arguments: (hi uint, lo uint, y uint)
Go returns: uint
Joker input arguments: [^Number hi, ^Number lo, ^Number y]
Joker returns: ^Number -
Rem32
Function v1.0(Rem32 hi lo y)
Rem32 returns the remainder of (hi, lo) divided by y. Rem32 panics
for y == 0 (division by zero) but, unlike Div32, it doesn't panic
on a quotient overflow.
Go input arguments: (hi uint32, lo uint32, y uint32)
Go returns: uint32
Joker input arguments: [^Number hi, ^Number lo, ^Number y]
Joker returns: ^Number -
Rem64
Function v1.0(Rem64 hi lo y)
Rem64 returns the remainder of (hi, lo) divided by y. Rem64 panics
for y == 0 (division by zero) but, unlike Div64, it doesn't panic
on a quotient overflow.
Go input arguments: (hi uint64, lo uint64, y uint64)
Go returns: uint64
Joker input arguments: [^Number hi, ^Number lo, ^Number y]
Joker returns: ^Number -
Reverse
Function v1.0(Reverse x)
Reverse returns the value of x with its bits in reversed order.
Go input arguments: (x uint)
Go returns: uint
Joker input arguments: [^Number x]
Joker returns: ^Number -
Reverse16
Function v1.0(Reverse16 x)
Reverse16 returns the value of x with its bits in reversed order.
Go input arguments: (x uint16)
Go returns: uint16
Joker input arguments: [^Int x]
Joker returns: ^Int -
Reverse32
Function v1.0(Reverse32 x)
Reverse32 returns the value of x with its bits in reversed order.
Go input arguments: (x uint32)
Go returns: uint32
Joker input arguments: [^Number x]
Joker returns: ^Number -
Reverse64
Function v1.0(Reverse64 x)
Reverse64 returns the value of x with its bits in reversed order.
Go input arguments: (x uint64)
Go returns: uint64
Joker input arguments: [^Number x]
Joker returns: ^Number -
Reverse8
Function v1.0(Reverse8 x)
Reverse8 returns the value of x with its bits in reversed order.
Go input arguments: (x uint8)
Go returns: uint8
Joker input arguments: [^Int x]
Joker returns: ^Int -
ReverseBytes
Function v1.0(ReverseBytes x)
ReverseBytes returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint)
Go returns: uint
Joker input arguments: [^Number x]
Joker returns: ^Number -
ReverseBytes16
Function v1.0(ReverseBytes16 x)
ReverseBytes16 returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint16)
Go returns: uint16
Joker input arguments: [^Int x]
Joker returns: ^Int -
ReverseBytes32
Function v1.0(ReverseBytes32 x)
ReverseBytes32 returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint32)
Go returns: uint32
Joker input arguments: [^Number x]
Joker returns: ^Number -
ReverseBytes64
Function v1.0(ReverseBytes64 x)
ReverseBytes64 returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint64)
Go returns: uint64
Joker input arguments: [^Number x]
Joker returns: ^Number -
RotateLeft
Function v1.0(RotateLeft x k)
RotateLeft returns the value of x rotated left by (k mod UintSize) bits.
To rotate x right by k bits, call RotateLeft(x, -k).
This function's execution time does not depend on the inputs.
Go input arguments: (x uint, k int)
Go returns: uint
Joker input arguments: [^Number x, ^Int k]
Joker returns: ^Number -
RotateLeft16
Function v1.0(RotateLeft16 x k)
RotateLeft16 returns the value of x rotated left by (k mod 16) bits.
To rotate x right by k bits, call RotateLeft16(x, -k).
This function's execution time does not depend on the inputs.
Go input arguments: (x uint16, k int)
Go returns: uint16
Joker input arguments: [^Int x, ^Int k]
Joker returns: ^Int -
RotateLeft32
Function v1.0(RotateLeft32 x k)
RotateLeft32 returns the value of x rotated left by (k mod 32) bits.
To rotate x right by k bits, call RotateLeft32(x, -k).
This function's execution time does not depend on the inputs.
Go input arguments: (x uint32, k int)
Go returns: uint32
Joker input arguments: [^Number x, ^Int k]
Joker returns: ^Number -
RotateLeft64
Function v1.0(RotateLeft64 x k)
RotateLeft64 returns the value of x rotated left by (k mod 64) bits.
To rotate x right by k bits, call RotateLeft64(x, -k).
This function's execution time does not depend on the inputs.
Go input arguments: (x uint64, k int)
Go returns: uint64
Joker input arguments: [^Number x, ^Int k]
Joker returns: ^Number -
RotateLeft8
Function v1.0(RotateLeft8 x k)
RotateLeft8 returns the value of x rotated left by (k mod 8) bits.
To rotate x right by k bits, call RotateLeft8(x, -k).
This function's execution time does not depend on the inputs.
Go input arguments: (x uint8, k int)
Go returns: uint8
Joker input arguments: [^Int x, ^Int k]
Joker returns: ^Int -
Sub
Function v1.0(Sub x y borrow)
Sub returns the difference of x, y and borrow: diff = x - y - borrow.
The borrow input must be 0 or 1; otherwise the behavior is undefined.
The borrowOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint, y uint, borrow uint)
Go returns: (diff uint, borrowOut uint)
Joker input arguments: [^Number x, ^Number y, ^Number borrow]
Joker returns: [^Number diff, ^Number borrowOut] -
Sub32
Function v1.0(Sub32 x y borrow)
Sub32 returns the difference of x, y and borrow, diff = x - y - borrow.
The borrow input must be 0 or 1; otherwise the behavior is undefined.
The borrowOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint32, y uint32, borrow uint32)
Go returns: (diff uint32, borrowOut uint32)
Joker input arguments: [^Number x, ^Number y, ^Number borrow]
Joker returns: [^Number diff, ^Number borrowOut] -
Sub64
Function v1.0(Sub64 x y borrow)
Sub64 returns the difference of x, y and borrow: diff = x - y - borrow.
The borrow input must be 0 or 1; otherwise the behavior is undefined.
The borrowOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
Go input arguments: (x uint64, y uint64, borrow uint64)
Go returns: (diff uint64, borrowOut uint64)
Joker input arguments: [^Number x, ^Number y, ^Number borrow]
Joker returns: [^Number diff, ^Number borrowOut] -
TrailingZeros
Function v1.0(TrailingZeros x)
TrailingZeros returns the number of trailing zero bits in x; the result is UintSize for x == 0.
Go input arguments: (x uint)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
TrailingZeros16
Function v1.0(TrailingZeros16 x)
TrailingZeros16 returns the number of trailing zero bits in x; the result is 16 for x == 0.
Go input arguments: (x uint16)
Go returns: int
Joker input arguments: [^Int x]
Joker returns: ^Int -
TrailingZeros32
Function v1.0(TrailingZeros32 x)
TrailingZeros32 returns the number of trailing zero bits in x; the result is 32 for x == 0.
Go input arguments: (x uint32)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
TrailingZeros64
Function v1.0(TrailingZeros64 x)
TrailingZeros64 returns the number of trailing zero bits in x; the result is 64 for x == 0.
Go input arguments: (x uint64)
Go returns: int
Joker input arguments: [^Number x]
Joker returns: ^Int -
TrailingZeros8
Function v1.0(TrailingZeros8 x)
TrailingZeros8 returns the number of trailing zero bits in x; the result is 8 for x == 0.
Go input arguments: (x uint8)
Go returns: int
Joker input arguments: [^Int x]
Joker returns: ^Int
Types
-
(None.)