Fix ordering of mask values
authorJeremy Kerr <jk@ozlabs.org>
Tue, 29 Jul 2008 03:18:46 +0000 (13:18 +1000)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 12 Nov 2009 23:58:48 +0000 (10:58 +1100)
We were creating the bits array in the wrong order, leading to
multiple-bit masks being decoded in reverse.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
bitfield

index ae5b138..467bf6b 100644 (file)
--- a/bitfield
+++ b/bitfield
@@ -54,7 +54,7 @@ class bitfield:
                val = mask << shift
                for i in range(0, width):
                        if mask & (1 << i):
-                               bits.append(width - i - 1 - shift)
+                               bits.insert(0, width - i - 1 - shift)
                return bits
 
        @staticmethod