changeset 954:a978f6160b41

Faster list unzipping.
author Martin Geisler <mg@daimi.au.dk>
date Sat, 27 Sep 2008 10:50:44 +0200
parents e1b809d032df
children 92923dd24908
files viff/comparison.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/viff/comparison.py	Sat Sep 27 10:43:56 2008 +0200
+++ b/viff/comparison.py	Sat Sep 27 10:50:44 2008 +0200
@@ -79,8 +79,7 @@
         assert self.num_players + 2 < 2**l
 
         bits = [self.prss_share_bit_double(field) for _ in range(m)]
-        int_bits = [a for (a, _) in bits]
-        bit_bits = [b for (_, b) in bits]
+        int_bits, bit_bits = zip(*bits)
 
         def bits_to_int(bits):
             """Converts a list of bits to an integer."""
@@ -93,7 +92,7 @@
         a = share_a - share_b + 2**l
         T = self.open(2**t - int_b + a)
 
-        result = gather_shares([T] + bit_bits)
+        result = gather_shares((T,) + bit_bits)
         self.schedule_callback(result, self._finish_greater_than_equal, l)
         return result