math/bits
CUE v0.18.0
Functions
And
And: func(a: int, b: int) -> intAnd sets and returns a to the bitwise "and" of a and b.
At
At: func(x: int, i: int) -> intAt returns the value of the i'th bit of x.
Clear
Clear: func(a: int, b: int) -> intClear sets and returns a to the bitwise "and not" of a and b (a &^ b in Go).
Len
Len: func(x: int) -> intLen returns the length of the absolute value of x in bits. The bit length of 0 is 0.
Lsh
Lsh: func(x: int, n: int) -> intLsh sets and returns x shifted left by n bits.
OnesCount
OnesCount: func(x: int) -> intOnesCount returns the number of one bits ("population count") in x.
Or
Or: func(a: int, b: int) -> intOr sets and returns a to the bitwise "or" of a and b (a | b in Go).
Rsh
Rsh: func(x: int, n: int) -> intRsh sets and returns x shifted right by n bits.
Set
Set: func(x: int, i: int, bit: int) -> intSet sets and returns x with x's i'th bit set to b (0 or 1). That is, if b is 1 Set returns x with its i'th bit set; if b is 0 Set returns x with its i'th bit cleared.
Xor
Xor: func(a: int, b: int) -> intXor sets and returns a to the bitwise xor of a and b (a ^ b in Go).