math/bits

CUE v0.18.0

Functions

And

cue
And: func(a: int, b: int) -> int

And sets and returns a to the bitwise "and" of a and b.

At

cue
At: func(x: int, i: int) -> int

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

Clear

cue
Clear: func(a: int, b: int) -> int

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

Len

cue
Len: func(x: int) -> int

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

Lsh

cue
Lsh: func(x: int, n: int) -> int

Lsh sets and returns x shifted left by n bits.

OnesCount

cue
OnesCount: func(x: int) -> int

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

Or

cue
Or: func(a: int, b: int) -> int

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

Rsh

cue
Rsh: func(x: int, n: int) -> int

Rsh sets and returns x shifted right by n bits.

Set

cue
Set: func(x: int, i: int, bit: int) -> int

Set 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

cue
Xor: func(a: int, b: int) -> int

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

Install CUE