MCPcopy Create free account
hub / github.com/cockroachdb/apd / altSetBit

Function altSetBit

bigint_test.go:1871–1881  ·  view source on GitHub ↗
(z *BigInt, x *BigInt, i int, b uint)

Source from the content-addressed store, hash-verified

1869}
1870
1871func altSetBit(z *BigInt, x *BigInt, i int, b uint) *BigInt {
1872 one := NewBigInt(1)
1873 m := one.Lsh(one, uint(i))
1874 switch b {
1875 case 1:
1876 return z.Or(x, m)
1877 case 0:
1878 return z.AndNot(x, m)
1879 }
1880 panic("set bit is not 0 or 1")
1881}
1882
1883func testBitset(t *testing.T, x *BigInt) {
1884 n := x.BitLen()

Callers 3

testBitsetFunction · 0.85

Calls 4

LshMethod · 0.95
NewBigIntFunction · 0.85
OrMethod · 0.80
AndNotMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…