Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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