Example #1
0
// And sets z = x & y and returns z.
func (z *Int) And(x, y *Int) *Int {
	z.doinit()
	x.doinit()
	y.doinit()
	C.mpz_and(z.ptr, x.ptr, y.ptr)
	return z
}
Example #2
0
File: int.go Project: locusf/gmp
// And sets z = x & y and returns z.
func (z *Int) And(x, y *Int) *Int {
	x.doinit()
	y.doinit()
	z.doinit()
	C.mpz_and(&z.i[0], &x.i[0], &y.i[0])
	return z
}
Example #3
0
File: int.go Project: locusf/gmp
// AndNot sets z = x &^ y and returns z.
func (z *Int) AndNot(x, y *Int) *Int {
	x.doinit()
	y.doinit()
	z.doinit()
	t := z
	aliased := false
	if z == y || z == x {
		aliased = true
		t = new(Int).Set(y)
	}
	C.mpz_com(&t.i[0], &y.i[0])
	C.mpz_and(&z.i[0], &x.i[0], &t.i[0])
	if aliased {
		t.Clear()
	}
	return z
}