1. Jason S
  2. libgf2

Commits

Jason S  committed c4c8ac8

minor feature additions

  • Participants
  • Parent commits deb2892
  • Branches default

Comments (0)

Files changed (2)

File src/libgf2/gf2.py

View file
                 p >>= 1
     return tuple(helper(p,n))
 
+def _gatherBits(v):
+    x = 0
+    p2 = 1
+    for b in v:
+        if b == 1:
+            x |= p2
+        p2 <<= 1
+    return x
+        
+
 def _gf2mul(x,y):
     z = 0
     while x > 0:

File src/libgf2/lfsr.py

View file
         '''inverse of lookaheadCoefficients'''
         s = self.stateFromCoefficients(c)
         return self.dlog.log(s)
+    def timeshiftFromState(self, s):
+        return self.dlog.log(s)
     def stateFromOutput(self, output, atEnd=True):
         '''returns the state of an LFSR with default mask that produces the given output.
         if atEnd is True, the state in question is the state at the end of the output.