コード例 #1
0
 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
コード例 #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
コード例 #3
0
ファイル: types.py プロジェクト: lance6716/SPDZ-2
 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
コード例 #4
0
ファイル: types.py プロジェクト: data61/MP-SPDZ
 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
コード例 #5
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