I was trying to read some values from an XML file, say the values represent the reset state of a hardware register. The <Field_Reset_Value>10</Field_Reset_Value>
represent two bits here as "1" and "0" respectively. I need to use these values to shift and bitwise or with other bit values further.
Now when I read the value, it is represented as a string. Can someone suggest the way, I can convert string to binary. Say as the example below.
string = "10"
Now I want to convert its binary value as binval = 0b10
.
Also, these values can be of any number of bits from 1 to 32 bit. What I mean is the string can also be 1101001110011
so I will need to represent it as 0b1101001110011