viff

changeset 634:9d4a0ade3918

Add floor division (//) overloading to field elements.
author Martin Geisler <mg@daimi.au.dk>
date Fri, 04 Apr 2008 11:03:26 +0200
parents 6581d7c7bc99
children a7f03661f81d
files viff/field.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/viff/field.py	Fri Apr 04 10:37:46 2008 +0200
     1.2 +++ b/viff/field.py	Fri Apr 04 11:03:26 2008 +0200
     1.3 @@ -217,6 +217,7 @@
     1.4          return self * ~other
     1.5  
     1.6      __truediv__ = __div__
     1.7 +    __floordiv__ = __div__
     1.8  
     1.9      def __rdiv__(self, other):
    1.10          """Division (reflected argument version).
    1.11 @@ -227,6 +228,7 @@
    1.12          return GF256(other) / self
    1.13  
    1.14      __rtruediv__ = __rdiv__
    1.15 +    __rfloordiv__ = __rdiv__
    1.16  
    1.17      def __neg__(self):
    1.18          """Negation."""
    1.19 @@ -418,12 +420,14 @@
    1.20                  return self * ~GFElement(other)
    1.21  
    1.22          __truediv__ = __div__
    1.23 +        __floordiv__ = __div__
    1.24  
    1.25          def __rdiv__(self, other):
    1.26              """Division (reflected argument version)."""
    1.27              return GFElement(other) / self
    1.28  
    1.29          __rtruediv__ = __rdiv__
    1.30 +        __rfloordiv__ = __rdiv__
    1.31  
    1.32          def sqrt(self):
    1.33              """Square root.