From: Luke Kenneth Casson Leighton Date: Mon, 22 Apr 2019 16:03:23 +0000 (+0100) Subject: reduce LFSR2.__init__ by another 2 lines X-Git-Tag: div_pipeline~2156 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f567d4dcc2c3f9006c2ef54072efbcf2ed39126e;p=soc.git reduce LFSR2.__init__ by another 2 lines --- diff --git a/TLB/src/LFSR2.py b/TLB/src/LFSR2.py index 814ad06f..4a44dfdf 100644 --- a/TLB/src/LFSR2.py +++ b/TLB/src/LFSR2.py @@ -8,12 +8,10 @@ class LFSRPolynomial(set): """ implements a polynomial for use in LFSR """ def __init__(self, exponents=()): - exponents = set(exponents) - exponents.add(0) # must contain zero for e in exponents: assert isinstance(e, int), TypeError("%s must be an int" % repr(e)) assert (e >= 0), ValueError("%d must not be negative" % e) - set.__init__(self, exponents) + set.__init__(self, set(exponents).union({0})) # must contain zero @property def max_exponent(self): @@ -21,7 +19,7 @@ class LFSRPolynomial(set): @property def exponents(self): - exponents = list(self) # get elements of set + exponents = list(self) # get elements of set as a list exponents.sort(reverse=True) return exponents