From: Luke Kenneth Casson Leighton Date: Tue, 16 Feb 2021 16:33:22 +0000 (+0000) Subject: adapt botchify so it can be used for 31- or 15- etc. etc. X-Git-Tag: convert-csv-opcode-to-binary~229^2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=002dce0d7bf02750fdae7611d6dab541b37e6bbf;p=soc.git adapt botchify so it can be used for 31- or 15- etc. etc. --- diff --git a/src/soc/consts.py b/src/soc/consts.py index 25ce8758..0482125b 100644 --- a/src/soc/consts.py +++ b/src/soc/consts.py @@ -1,9 +1,9 @@ # sigh create little-ended versions of bitfield flags -def botchify(bekls, lekls): +def botchify(bekls, lekls, msb=63): for attr in dir(bekls): if attr[0] == '_': continue - setattr(lekls, attr, 63-getattr(bekls, attr)) + setattr(lekls, attr, msb-getattr(bekls, attr)) # Can't think of a better place to put these functions.