field_mask¶
-
Math.Bin.
field_mask
(bits, leftshift=0)¶ Set a bit mask
- Example::
In [2]: bin(field_mask(“5:0”)) Out[2]: ‘0b111111’ In [4]: bin(field_mask(“5:0”, leftshift=6)) Out[4]: ‘0b111111000000’ In [5]: bin(field_mask(“111111”, leftshift=6)) Out[5]: ‘0b111111000000’ In [6]: field_mask(“111111”, leftshift=6) Out[6]: 4032
:param bits : mask bit pattern, like ‘111111’ or ‘0b111111’ or range ‘5:0’ :type bits : str
:param leftshift : number of bits to move to left (to m.s.b.) :type leftshift : int
- Returns
int