diff --git a/galois.py b/galois.py index e2298c3..90dc53f 100755 --- a/galois.py +++ b/galois.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # # Native python routines for Galois field calculations. # @@ -105,7 +105,7 @@ class GaloisFieldLog: self.bits = bits self.size = (1 << bits) self.prim = self.poly_defaults[bits] if not primitive_polynomial else primitive_polynomial - self.value_format = repr_prefix + '{:0>' + str(bits / 4) + 'x}' + self.value_format = repr_prefix + '{:0>' + str(bits // 4) + 'x}' self.alpha = alpha # Set up the log and anti-log tables self.log_tbl = [0] * self.size @@ -258,19 +258,20 @@ class GaloisFieldDirect: return True if __name__ == '__main__': - print '\nTesting direct fields...........' + print ('\nTesting direct fields...........') for width in GaloisFieldDirect.field_widths: field = GaloisFieldDirect (width) g0 = GaloisNumber (field, 2) g1 = GaloisNumber (field, 7) - print '{0} + {1} = {2}'.format (g0, g1, g0 + g1) + print ('{0} + {1} = {2}'.format (g0, g1, g0 + g1)) if field.self_test (): - print "{0} bit field (direct) passed!".format (width) - print '\nTesting log fields...........' + print ("{0} bit field (direct) passed!".format (width)) + print ('\nTesting log fields...........') for width in GaloisFieldLog.field_widths: field = GaloisFieldLog (width) g0 = GaloisNumber (field, 2) g1 = GaloisNumber (field, 7) - print '{0} + {1} = {2}'.format (g0, g1, g0 + g1) + print ('{0} + {1} = {2}'.format (g0, g1, g0 + g1)) if field.self_test (): - print "{0} bit field (log) passed!".format (width) + print ("{0} bit field (log) passed!".format (width)) +