PYTHON equivalents of BITAND and BITSHIFT of MATLAB

blmadhavan at gmail.com blmadhavan at gmail.com
Wed May 1 13:35:59 EDT 2019


Hi,

I have the following line from a MATLAB program with FCF (format: UInt_16) as input:

ftype = bitand(FCF, 7)
typeBits = bitshift(FCF, -9)
subtype = bitand(typeBits, 7)

I wrote the following in Python for the above commands:

ftype = FCF & 7
typeBits = FCF << -9             ------> Is this correct or FCF >> -9?
subtype = typeBits & 7
 
Can someone help me write the equivalent command in PYTHON?

Look forward to your suggestions.


More information about the Python-list mailing list