Example #1
0
 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
Example #2
0
 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
Example #3
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
Example #4
0
 def is_long_one(self, other):
     return util.is_all_ones(other, self.n) or \
         (other is None and self.n == None)