Addition of numbers via Bits object?
#358
-
|
There is already the special method |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hi. Yes you can modify an interpretation of a The line Hope that helps. |
Beta Was this translation helpful? Give feedback.
-
|
Oh, and you can also do this with the This is storing 3 unsigned integers in 30 bits of data and manipulating their values. |
Beta Was this translation helpful? Give feedback.
Hi. Yes you can modify an interpretation of a
BitArrayobject to do what I think you're trying to do. Note that this doesn't work for aBitsclass as that's immutable.The line
a.u += 11gets the unsigned integer interpretation of the binary data, adds eleven to it, then resets the data with the new value (keeping the length the same).Hope that helps.