def vands(self, *others): res = self.new(n=self.n) for other in others: assert (self.n == other.n) fanin = len(others) + 1 inst.ands(fanin, self.n, res, self, *others) return res
def __and__(self, other): if util.is_zero(other): return 0 elif util.is_all_ones(other, self.n): return self assert (self.n == other.n) res = self.new(n=self.n) inst.ands(self.n, res, self, other) return res
def __and__(self, other): if util.is_zero(other): return 0 elif util.is_all_ones(other, self.n): return self assert(self.n == other.n) res = self.new(n=self.n) inst.ands(self.n, res, self, other) return res
def _and(self, other): res = self.new(n=self.n) if not isinstance(other, sbits): other = cbits.get_type(self.n).conv(other) inst.andm(self.n, res, self, other) return res other = self.conv(other) assert(self.n == other.n) inst.ands(self.n, res, self, other) return res
def __and__(self, other): if util.is_zero(other): return 0 elif util.is_all_ones(other, self.n): return self res = self.new(n=self.n) if not isinstance(other, sbits): other = cbits.get_type(self.n).conv(other) inst.andm(self.n, res, self, other) return res other = self.conv(other) assert(self.n == other.n) inst.ands(self.n, res, self, other) return res